Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_father when can i be on my own i have the hello world to see
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
father when can i be on my own i have the hello world to see
widget_father when can i be on my own i have the hello world to see
Commits
10b13887
Commit
10b13887
authored
May 19, 2022
by
Emilio Gentolia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created detail and index template for announcements.
parent
5d13d77d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
9 deletions
+66
-9
announcement_detail.css
...t_board/static/announcement_board/announcement_detail.css
+0
-0
announcement_index.css
...nt_board/static/announcement_board/announcement_index.css
+0
-0
announcement_detail.html
...ard/templates/announcement_board/announcement_detail.html
+21
-0
index.html
announcement_board/templates/announcement_board/index.html
+29
-0
urls.py
announcement_board/urls.py
+3
-3
views.py
announcement_board/views.py
+10
-3
base_style.css
static/base_style.css
+2
-2
base.html
templates/base.html
+1
-1
No files found.
announcement_board/static/announcement_board/announcement_detail.css
0 → 100644
View file @
10b13887
announcement_board/static/announcement_board/announcement_index.css
0 → 100644
View file @
10b13887
announcement_board/templates/announcement_board/announcement_detail.html
0 → 100644
View file @
10b13887
<!-- announcements/announcement_detail.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Homepage{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'announcement_board/widgetuser_details.css' %}"
>
{% endblock %}
{% block header %}
<img
width=
"50"
height=
"50"
src=
""
/>
{{object.announcement_title}}
{% endblock %}
{% block content %}
<p>
by {{object.author.first_name}} {{object.author.last_name}}, {{object.pub_date | date:"d/m/o"}}
</p>
<p>
Likes: {{reaction_likes}}
</p>
<p>
Love: {{reaction_love}}
</p>
<p>
Angry: {{reaction_angry}}
</p>
{% endblock %}
\ No newline at end of file
announcement_board/templates/announcement_board/index.html
0 → 100644
View file @
10b13887
<!-- announcements/index.html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Announcements{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'announcements/announcement_index.css' %}"
>
{% endblock %}
{% block header %}
Announcement Board
{% endblock %}
{% block content %}
<p>
Important announcements:
</p>
<ul>
{% for announcement in all_announcements %}
<li>
<a
class=
"details"
href=
"{{announcement.id}}/details"
>
{{announcement.announcement_title}} by
{{announcement.author.first_name}},
{{announcement.author.last_name}} dated
{{announcement.pub_date | date:"d/m/o"}}
</a>
</br>
</li>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
announcement_board/urls.py
View file @
10b13887
from
django.urls
import
path
from
.views
import
index
from
.views
import
AnnouncementView
,
AnnouncementDetailView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
AnnouncementView
.
as_view
(),
name
=
'index'
),
path
(
'<int:pk>/details'
,
AnnouncementDetailView
.
as_view
(),
name
=
'announcement_detail'
)
]
app_name
=
"announcement_board"
\ No newline at end of file
announcement_board/views.py
View file @
10b13887
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
.models
import
Announcement
from
.models
import
Announcement
,
Reaction
class
AnnouncementView
(
View
):
def
get
(
self
,
request
):
objects_set
=
{
"all_announcements"
:
[
obj
for
obj
in
Announcement
.
objects
.
all
()
.
order_by
(
'
last_nam
e'
)]
"all_announcements"
:
[
obj
for
obj
in
Announcement
.
objects
.
all
()
.
order_by
(
'
-pub_dat
e'
)]
}
return
render
(
request
,
'
homepage
/index.html'
,
objects_set
)
return
render
(
request
,
'
announcement_board
/index.html'
,
objects_set
)
class
AnnouncementDetailView
(
DetailView
):
model
=
Announcement
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'reaction_likes'
]
=
Reaction
.
objects
.
filter
(
announcement_id
=
self
.
kwargs
[
'pk'
])
.
filter
(
reaction_name
=
"Like"
)
.
first
()
.
tally
context
[
'reaction_love'
]
=
Reaction
.
objects
.
filter
(
announcement_id
=
self
.
kwargs
[
'pk'
])
.
filter
(
reaction_name
=
"Love"
)
.
first
()
.
tally
context
[
'reaction_angry'
]
=
Reaction
.
objects
.
filter
(
announcement_id
=
self
.
kwargs
[
'pk'
])
.
filter
(
reaction_name
=
"Angry"
)
.
first
()
.
tally
return
context
static/base_style.css
View file @
10b13887
...
...
@@ -17,7 +17,7 @@
nav
:focus
{
outline
:
0
!important
;
}
ul
{
.ul-links
{
list-style-type
:
none
;
margin
:
0
;
padding
:
0
;
...
...
@@ -26,7 +26,7 @@ ul {
width
:
100%
;
background-color
:
#bb00ff
;
}
ul
li
{
.ul-links
li
{
padding
:
20px
;
}
.links
{
...
...
templates/base.html
View file @
10b13887
...
...
@@ -9,7 +9,7 @@
</head>
<body>
<nav>
<ul>
<ul
class=
"ul-links"
>
<li><a
class=
"links"
href=
"/homepage/"
>
HOMEPAGE
</a></li>
<li><a
class=
"links"
href=
"/assignments/"
>
ASSIGNMENTS
</a></li>
<li><a
class=
"links"
href=
"/forum/"
>
FORUM
</a></li>
...
...
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