Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_casanatics
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
John Aidan Vincent M. Ng
midterm_casanatics
Commits
f691394d
Commit
f691394d
authored
Mar 04, 2023
by
justin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting fixes
parent
a4affa42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
views.py
widget_casanatics/forum/views.py
+7
-10
No files found.
widget_casanatics/forum/views.py
View file @
f691394d
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
ForumPost
,
Reply
# Create your views here.
def
forum
(
request
):
forum_view
=
""
# fetch forum posts and replies
forum
=
ForumPost
.
objects
.
all
()
replies
=
Reply
.
objects
.
all
()
forum_view
=
"Widget's Forum <br> <br> Forum Posts:<br>"
for
post
in
forum
:
forum_view
+=
'''
forum_view
+=
"""
{} by {} posted {}: <br>
{} <br>
'''
.
format
(
"""
.
format
(
post
.
title
,
post
.
author
,
post
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p"
),
...
...
@@ -25,13 +22,13 @@ def forum(request):
# Check if reply is for that specific forum_post
for
reply
in
replies
:
if
reply
.
forum
==
post
:
forum_view
+=
'''
forum_view
+=
"""
Reply by {} posted {}: <br>
{} <br>
'''
.
format
(
"""
.
format
(
reply
.
author
,
reply
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p"
),
reply
.
body
reply
.
body
,
)
forum_view
+=
"<br>"
return
HttpResponse
(
forum_view
)
\ No newline at end of file
return
HttpResponse
(
forum_view
)
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