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
717e2b08
Commit
717e2b08
authored
Mar 04, 2023
by
Andre Dalwin C. Tan
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Views.py
parent
030df003
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
views.py
widget_casanatics/forum/views.py
+11
-12
No files found.
widget_casanatics/forum/views.py
View file @
717e2b08
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
ForumPost
,
Reply
from
.models
import
ForumPost
# Create your views here.
# Create your views here.
...
@@ -9,10 +9,10 @@ def forum(request):
...
@@ -9,10 +9,10 @@ def forum(request):
# fetch forum posts and replies
# fetch forum posts and replies
forum
=
ForumPost
.
objects
.
all
()
forum
=
ForumPost
.
objects
.
all
()
replies
=
Reply
.
objects
.
all
()
forum_view
=
"Widget's Forum <br> <br> Forum Posts:<br>"
forum_view
=
"Widget's Forum <br> <br> Forum Posts:<br>"
for
post
in
forum
:
for
post
in
forum
:
post_replies
=
post
.
reply_set
.
all
()
forum_view
+=
'''
forum_view
+=
'''
{} by {} posted {}: <br>
{} by {} posted {}: <br>
{} <br>
{} <br>
...
@@ -23,8 +23,7 @@ def forum(request):
...
@@ -23,8 +23,7 @@ def forum(request):
post
.
body
,
post
.
body
,
)
)
# Check if reply is for that specific forum_post
# Check if reply is for that specific forum_post
for
reply
in
replies
:
for
reply
in
post_replies
:
if
reply
.
forum
==
post
:
forum_view
+=
'''
forum_view
+=
'''
Reply by {} posted {}: <br>
Reply by {} posted {}: <br>
{} <br>
{} <br>
...
...
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