Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 18
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
Rac Gerard Elizaga
widget_group 18
Commits
01034b9f
Commit
01034b9f
authored
Apr 04, 2022
by
Rac Gerard Elizaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified forum views.py to use HttpResponse instead of HTML templates
parent
00638540
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
views.cpython-38.pyc
widget_group_18/forum/__pycache__/views.cpython-38.pyc
+0
-0
forum.html
widget_group_18/forum/templates/forum.html
+0
-12
views.py
widget_group_18/forum/views.py
+13
-1
No files found.
widget_group_18/forum/__pycache__/views.cpython-38.pyc
View file @
01034b9f
No preview for this file type
widget_group_18/forum/templates/forum.html
deleted
100644 → 0
View file @
00638540
FORUM POSTS:
<br>
{% for i in post %}
{{i.post_title}} by {{i.author.first_name}} {{i.author.last_name}} dated {{i.pub_date.date|date:"m/d/Y"}}:
<br>
{{i.post_body}}
<br>
{% for j in reply %}
{% if j.post == i %}
Reply by {{j.author.first_name}} {{j.author.last_name}} dated {{j.pub_date.date|date:"m/d/Y"}}:
<br>
{{j.reply_body}}
<br>
{% endif %}
{% endfor %}
<br>
{% endfor %}
\ No newline at end of file
widget_group_18/forum/views.py
View file @
01034b9f
...
...
@@ -3,7 +3,19 @@ from django.http import HttpResponse
from
.models
import
Post
,
Reply
def
index
(
request
):
message
=
'FORUM POSTS:<br/>'
post
=
Post
.
objects
.
all
()
reply
=
Reply
.
objects
.
all
()
return
render
(
request
,
'forum.html'
,
{
'post'
:
post
,
'reply'
:
reply
})
\ No newline at end of file
for
i
in
post
:
post_date
=
i
.
pub_date
.
date
()
.
strftime
(
"
%
m/
%
d/
%
Y"
)
message
+=
f
'{i.post_title} by {i.author.first_name} {i.author.last_name} dated {post_date}:<br/>{i.post_body}<br/>'
for
j
in
reply
:
if
j
.
post
==
i
:
reply_date
=
j
.
pub_date
.
date
()
.
strftime
(
"
%
m/
%
d/
%
Y"
)
message
+=
f
'Reply by {j.author.first_name} {j.author.last_name} dated {reply_date}:<br/>{j.reply_body}<br/>'
message
+=
'<br/>'
return
HttpResponse
(
message
)
\ No newline at end of file
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