Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_mgabolanimav
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mavrick Jordan Lee
midterm_mgabolanimav
Commits
79b393ca
Commit
79b393ca
authored
May 06, 2023
by
Ross Batacan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created empty templates for announcements home, edit, create, and details views
parent
f81011c5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
34 deletions
+127
-34
announcement-add.html
...nouncements/templates/announcements/announcement-add.html
+10
-0
announcement-details.html
...cements/templates/announcements/announcement-details.html
+10
-0
announcement-edit.html
...ouncements/templates/announcements/announcement-edit.html
+10
-0
announcements.html
.../announcements/templates/announcements/announcements.html
+41
-0
urls.py
widget_mgabolanimav/announcements/urls.py
+2
-1
views.py
widget_mgabolanimav/announcements/views.py
+53
-32
base.html
widget_mgabolanimav/templates/base.html
+1
-1
No files found.
widget_mgabolanimav/announcements/templates/announcements/announcement-add.html
0 → 100644
View file @
79b393ca
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
widget_mgabolanimav/announcements/templates/announcements/announcement-details.html
0 → 100644
View file @
79b393ca
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
widget_mgabolanimav/announcements/templates/announcements/announcement-edit.html
0 → 100644
View file @
79b393ca
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
widget_mgabolanimav/announcements/templates/announcements/announcements.html
0 → 100644
View file @
79b393ca
<!--def announcements(request):-->
<!-- announcement = Announcement.objects.all()-->
<!-- response = "<h3>Widget's Announcement Board</h3>"-->
<!-- for every in announcement:-->
<!-- datetime = every.announcement_pub_datetime.strftime("%a, %b %d, %Y %I:%M %p")-->
<!-- response += "<p>{}".format(every.announcement_title) +\-->
<!-- " By {}".format(every.announcement_author.first_name) +\-->
<!-- " {}".format(every.announcement_author.last_name) +\-->
<!-- " published {}".format(datetime) +\-->
<!-- "<br>{}".format(every.announcement_body)-->
<!-- like_on_post = 0-->
<!-- love_on_post = 0-->
<!-- angry_on_post = 0-->
<!-- reactions = Reaction.objects.filter(reaction_announcement=every)-->
<!-- for every in reactions:-->
<!-- if every.reaction_name == "Like":-->
<!-- like_on_post = every.reaction_tally-->
<!-- elif every.reaction_name == "Love":-->
<!-- love_on_post = every.reaction_tally-->
<!-- elif every.reaction_name == "Angry":-->
<!-- angry_on_post = every.reaction_tally-->
<!-- response += "<br>like: {}".format(like_on_post) +\-->
<!-- "<br>love: {}".format(love_on_post) +\-->
<!-- "<br>angry: {}<br>".format(angry_on_post)-->
<!-- return HttpResponse(response)-->
{% extends 'base.html' %}
{% block title %}My Favorite Books
&
Authors{% endblock %}
{% block content %}
<h1>
Welcome to Widget's Announcement Board!
</h1>
<h3>
Announcements:
</h3>
{% endblock %}
widget_mgabolanimav/announcements/urls.py
View file @
79b393ca
...
@@ -3,5 +3,6 @@ from . import views
...
@@ -3,5 +3,6 @@ from . import views
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
announcements
,
name
=
"announcements"
)
path
(
''
,
views
.
announcements
,
name
=
"announcements"
),
path
(
''
)
]
]
widget_mgabolanimav/announcements/views.py
View file @
79b393ca
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
,
Reaction
# Create your views here.
# Create your views here.
def
home
(
request
):
return
render
(
request
,
'announcements/announcements.html'
)
class
AnnouncementsDetailsView
(
DetailView
):
model
=
Announcement
template_name
=
'announcements/announcement-details.html'
class
AnnouncementsCreateView
(
CreateView
):
model
=
Announcement
template_name
=
'announcements/announcement-add.html'
class
AnnouncementsEditView
(
UpdateView
):
model
=
Announcement
template_name
=
'announcements/announcement-edit.html'
# def announcements(request):
# announcement = Announcement.objects.all()
#
# response = "<h3>Widget's Announcement Board</h3>"
#
# for every in announcement:
# datetime = every.announcement_pub_datetime.strftime("%a, %b %d, %Y %I:%M %p")
#
# response += "<p>{}".format(every.announcement_title) +\
# " By {}".format(every.announcement_author.first_name) +\
# " {}".format(every.announcement_author.last_name) +\
# " published {}".format(datetime) +\
# "<br>{}".format(every.announcement_body)
#
# like_on_post = 0
# love_on_post = 0
# angry_on_post = 0
# reactions = Reaction.objects.filter(reaction_announcement=every)
#
# for every in reactions:
# if every.reaction_name == "Like":
# like_on_post = every.reaction_tally
# elif every.reaction_name == "Love":
# love_on_post = every.reaction_tally
# elif every.reaction_name == "Angry":
# angry_on_post = every.reaction_tally
#
# response += "<br>like: {}".format(like_on_post) +\
# "<br>love: {}".format(love_on_post) +\
# "<br>angry: {}<br>".format(angry_on_post)
#
# return HttpResponse(response)
def
announcements
(
request
):
announcement
=
Announcement
.
objects
.
all
()
response
=
"<h3>Widget's Announcement Board</h3>"
for
every
in
announcement
:
datetime
=
every
.
announcement_pub_datetime
.
strftime
(
"
%
a,
%
b
%
d,
%
Y
%
I:
%
M
%
p"
)
response
+=
"<p>{}"
.
format
(
every
.
announcement_title
)
+
\
" By {}"
.
format
(
every
.
announcement_author
.
first_name
)
+
\
" {}"
.
format
(
every
.
announcement_author
.
last_name
)
+
\
" published {}"
.
format
(
datetime
)
+
\
"<br>{}"
.
format
(
every
.
announcement_body
)
like_on_post
=
0
love_on_post
=
0
angry_on_post
=
0
reactions
=
Reaction
.
objects
.
filter
(
reaction_announcement
=
every
)
for
every
in
reactions
:
if
every
.
reaction_name
==
"Like"
:
like_on_post
=
every
.
reaction_tally
elif
every
.
reaction_name
==
"Love"
:
love_on_post
=
every
.
reaction_tally
elif
every
.
reaction_name
==
"Angry"
:
angry_on_post
=
every
.
reaction_tally
response
+=
"<br>like: {}"
.
format
(
like_on_post
)
+
\
"<br>love: {}"
.
format
(
love_on_post
)
+
\
"<br>angry: {}<br>"
.
format
(
angry_on_post
)
return
HttpResponse
(
response
)
widget_mgabolanimav/templates/base.html
View file @
79b393ca
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<head>
<head>
<link
rel=
"stylesheet"
href=
"style.css"
>
<link
rel=
"stylesheet"
href=
"style.css"
>
<title>
<title>
</title>
</title>
{% block styles %}{% endblock %}
{% block styles %}{% endblock %}
</head>
</head>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment