Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_quintupoltrobol
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
Matthew Karl David P. Arpas
midterm_quintupoltrobol
Commits
6c895ef8
Commit
6c895ef8
authored
Mar 05, 2023
by
karin-kurusu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made Forum views.py display the data from the models ForumPost and Reply
parent
824a8e1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
db.sqlite3
widget_quintupoltrobol/db.sqlite3
+0
-0
views.cpython-310.pyc
...t_quintupoltrobol/forum/__pycache__/views.cpython-310.pyc
+0
-0
views.py
widget_quintupoltrobol/forum/views.py
+23
-1
No files found.
widget_quintupoltrobol/db.sqlite3
View file @
6c895ef8
No preview for this file type
widget_quintupoltrobol/forum/__pycache__/views.cpython-310.pyc
View file @
6c895ef8
No preview for this file type
widget_quintupoltrobol/forum/views.py
View file @
6c895ef8
from
django.shortcuts
import
render
from
.models
import
ForumPost
,
Reply
from
django.http
import
HttpResponse
def
pageview
(
request
):
return
HttpResponse
()
forumposts
=
ForumPost
.
objects
.
all
()
replys
=
Reply
.
objects
.
all
()
string_builder
=
"Widget's Forum <br> <br> Forum Posts: <br> "
for
forumpost
in
forumposts
:
string_builder
=
"{} <br> {} by {} posted {} <br> {}"
.
format
(
string_builder
,
forumpost
.
title
,
forumpost
.
author
,
forumpost
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p:"
),
forumpost
.
body
)
for
reply
in
replys
:
if
reply
.
forumpost
==
forumpost
:
string_builder
=
"{} <br> Reply by {} posted {} <br> {}"
.
format
(
string_builder
,
reply
.
author
,
reply
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p:"
),
reply
.
body
)
string_builder
+=
"<br>"
return
HttpResponse
(
string_builder
)
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