Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group22
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 Tamano
widget_group22
Commits
068cf53b
Commit
068cf53b
authored
May 13, 2022
by
N1o9r4b7e9r6to
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed comments & codes, change order method to be more apt
parent
3ce4bf3c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
views.py
widget_group22/forum/views.py
+7
-15
No files found.
widget_group22/forum/views.py
View file @
068cf53b
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
.
import
models
from
.
import
models
#from asyncio.windows_events import NULL
from
django.http
import
Http404
,
HttpResponse
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.template
import
Template
,
Context
from
django.template
import
Template
,
Context
from
django.template.loader
import
get_template
from
django.template.loader
import
get_template
from
forum.models
import
Post
,
Reply
from
forum.models
import
Post
,
Reply
def
forumposts
(
request
):
def
forumposts
(
request
):
all_posts
=
models
.
Post
.
objects
.
order_by
(
"-pub_date"
)
all_posts
=
models
.
Post
.
objects
.
order_by
(
"-id"
)
#all_replies = models.Reply.objects.all()
context
=
{
context
=
{
"all_posts"
:
all_posts
,
"all_posts"
:
all_posts
,
#"all_replies":all_replies
}
}
return
render
(
request
,
"forum/forum.html"
,
context
)
return
render
(
request
,
"forum/forum.html"
,
context
)
def
forumreplies
(
request
):
all_replies
=
models
.
Reply
.
objects
.
all
()
context
=
{
#"all_posts":all_posts,
"all_replies"
:
all_replies
}
return
render
(
request
,
"forum/details.html"
,
context
)
def
DisplayPostdetails
(
request
,
post_id
):
def
DisplayPostdetails
(
request
,
post_id
):
try
:
post
=
Post
.
objects
.
get
(
pk
=
post_id
)
post
=
Post
.
objects
.
get
(
pk
=
post_id
)
reply
=
Reply
.
objects
.
order_by
(
"-pub_date"
)
reply
=
Reply
.
objects
.
order_by
(
"-id"
)
except
Post
.
DoesNotExist
:
raise
Http404
(
"This Post Does Not Exist!"
)
context
=
{
context
=
{
"post"
:
post
,
"post"
:
post
,
"reply"
:
reply
,
"reply"
:
reply
,
...
...
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