Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_someone here is possessed by an owl
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
Laetitia de Castro
widget_someone here is possessed by an owl
Commits
d62ea444
Commit
d62ea444
authored
May 23, 2022
by
Titia de Castro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added announcement detail view
parent
992f3588
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
announcement_detail.html
...ncements/templates/announcements/announcement_detail.html
+20
-0
views.py
announcements/views.py
+5
-1
No files found.
announcements/templates/announcements/announcement_detail.html
0 → 100644
View file @
d62ea444
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Document
</title>
</head>
<body>
<h1>
{{ announcement.announcement_title }}
</h1>
<h2>
by {{ announcement.author.first_name }} {{ announcement.author.last_name }} dated {{ announcement.pub_date|date:'d/m/Y' }}
</h2>
<p>
{{ announcement.announcement_body }}
</p>
{% for reaction in announcement.reactions.all %}
<p>
{{ reaction.reaction_name }} Reactions: {{ reaction.getTally }}
</p>
{% endfor %}
</body>
</html>
\ No newline at end of file
announcements/views.py
View file @
d62ea444
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
from
.models
import
Announcement
from
.models
import
Announcement
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
return
render
(
request
,
'index.html'
,
{
'announcements'
:
Announcement
.
objects
.
order_by
(
'-pub_date'
)})
return
render
(
request
,
'index.html'
,
{
'announcements'
:
Announcement
.
objects
.
order_by
(
'-pub_date'
)})
\ No newline at end of file
class
AnnouncementDetailView
(
DetailView
):
model
=
Announcement
\ No newline at end of file
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