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
069c0f7f
Commit
069c0f7f
authored
May 14, 2023
by
Migs Atienza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forum.html (no working post links)
parent
9294054e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
views.cpython-39.pyc
widget_k3git/forum/__pycache__/views.cpython-39.pyc
+0
-0
forum.html
widget_k3git/forum/templates/forum/forum.html
+18
-0
views.py
widget_k3git/forum/views.py
+1
-14
No files found.
widget_k3git/forum/__pycache__/views.cpython-39.pyc
View file @
069c0f7f
No preview for this file type
widget_k3git/forum/templates/forum/forum.html
0 → 100644
View file @
069c0f7f
{% extends 'base.html' %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
<h1>
Welcome to Widget's Forum!
</h1>
<h3>
{% for post in forumposts %}
<a
href=
"{{ forum.get_absolute_url }}"
>
{{ post.title }} by {{ post.author }}
</a><br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a
href=
"/dashboard"
>
Dashboard
</a><br>
<a
href=
"/announcement"
>
Announcements
</a><br>
<a
href=
"/assignments"
>
Assignments
</a><br>
<a
href=
"/calendar"
>
Calendar
</a>
{% endblock %}
\ No newline at end of file
widget_k3git/forum/views.py
View file @
069c0f7f
...
...
@@ -5,19 +5,6 @@ from .models import ForumPost, Reply
def
index
(
request
):
page_content
=
"""<H1>Widget’s Forum</H1>"""
for
forum
in
ForumPost
.
objects
.
all
():
newForumDateTime
=
forum
.
pub_datetime
.
strftime
(
"
%
m-
%
d-
%
Y
%
I:
%
M
%
p"
)
page_content
+=
"""<br>
{} by {} posted {}:<br>
{}<br>
"""
.
format
(
forum
.
title
,
forum
.
author
,
newForumDateTime
,
forum
.
body
)
for
reply
in
Reply
.
objects
.
all
():
if
reply
.
forum_post
==
forum
:
newReplyDateTime
=
reply
.
pub_datetime
.
strftime
(
"
%
m-
%
d-
%
Y
%
I:
%
M
%
p"
)
page_content
+=
"""Reply by {} posted {}:<br>
{}<br>
"""
.
format
(
reply
.
author
,
newReplyDateTime
,
reply
.
body
)
return
HttpResponse
(
page_content
)
return
render
(
request
,
'forum/forum.html'
,
{
'forumposts'
:
ForumPost
.
objects
.
all
()})
# Create your views here.
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