Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_k3git
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
Stefan Gomez
midterm_k3git
Commits
d064d28b
Commit
d064d28b
authored
May 15, 2023
by
MJoshBen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the Templates folder and Created the Main Announcement Page
parent
79e2ddbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
announcement.html
...git/announcement/templates/announcement/announcement.html
+18
-0
views.py
widget_k3git/announcement/views.py
+2
-11
No files found.
widget_k3git/announcement/templates/announcement/announcement.html
0 → 100644
View file @
d064d28b
{% extends 'base.html' %}
{% block title %}Widget's Announcement Board{% endblock %}
{% block content %}
<h1>
Welcome to Widget's Announcement Board!
</h1>
<h3>
{% for announcement in announcements %}
<a
href=
"{{ announcement.get_absolute_url }}"
>
{{ announcement.name }}
</a><br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a
href=
"/announcement/add"
><input
type=
"submit"
value=
"New Announcement"
></a><br><br>
<a
href=
"/dashboard"
>
Dashboard
</a><br>
<a
href=
"/assignment"
>
Assignments
</a><br>
<a
href=
"/forum"
>
Forum
</a><br>
<a
href=
"/calendar"
>
Calendar
</a>
{% endblock %}
widget_k3git/announcement/views.py
View file @
d064d28b
...
...
@@ -4,14 +4,5 @@ from django.http import HttpResponse
from
.models
import
Announcement
,
Reaction
def
index
(
request
):
page_content
=
"""<H1>Widget's Announcement Board</H1?"""
for
announcement
in
Announcement
.
objects
.
all
():
newAnnouncementDateTime
=
announcement
.
pub_datetime
.
strftime
(
"
%
m-
%
d-
%
Y
%
I:
%
M
%
p"
)
page_content
+=
"""<br> <br>
{} by {} published {}:<br>
{}<br>"""
.
format
(
announcement
.
title
,
announcement
.
author
,
newAnnouncementDateTime
,
announcement
.
body
)
for
reaction
in
Reaction
.
objects
.
all
():
if
reaction
.
announcement
==
announcement
:
page_content
+=
"""<br>{}: {}
"""
.
format
(
reaction
.
name
,
reaction
.
tally
)
return
HttpResponse
(
page_content
)
return
render
(
request
,
'announcement/announcement.html'
,
{
'assignments'
:
Announcement
.
objects
.
all
()})
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