Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_placeholdername
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
Rajo Christian Cadorna
widget_placeholdername
Commits
261d274c
Commit
261d274c
authored
May 26, 2022
by
Eugene Ezekiel P. Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added CBV for Forum
parent
adfc2aac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
urls.py
Forum/urls.py
+4
-2
views.py
Forum/views.py
+12
-10
No files found.
Forum/urls.py
View file @
261d274c
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
MainForumPage
from
.
import
views
from
.
import
views
app_name
=
"Forum"
app_name
=
"Forum"
urlpatterns
=
[
urlpatterns
=
[
#forum home page
#forum home page
path
(
''
,
views
.
index
,
name
=
'index'
),
path
(
''
,
MainForumPage
.
as_view
()
,
name
=
'index'
),
#forum posts
#forum posts
path
(
"<int:post_id>/details/"
,
views
.
posts
,
name
=
'post'
),
path
(
"<int:post_id>/details/"
,
views
.
posts
,
name
=
'post'
),
#making new forum posts
#making new forum posts
path
(
"posts/add/"
,
views
.
newPost
,
name
=
'addPost'
)
path
(
"posts/add/"
,
views
.
newPost
,
name
=
'addPost'
)
]
]
Forum/views.py
View file @
261d274c
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views
import
View
import
Forum
import
Forum
from
.forms
import
PostForm
from
.forms
import
PostForm
from
.
models
import
Post
,
Reply
from
.
models
import
Post
,
Reply
from
homepage.models
import
WidgetUser
from
homepage.models
import
WidgetUser
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
def
index
(
request
):
class
MainForumPage
(
View
):
def
get
(
self
,
request
):
Posts
=
Post
.
objects
.
all
()
Posts
=
Post
.
objects
.
all
()
Replies
=
Reply
.
objects
.
all
()
Replies
=
Reply
.
objects
.
all
()
post_list
=
Post
.
objects
.
order_by
(
"-pub_date"
)
post_list
=
Post
.
objects
.
order_by
(
"-pub_date"
)
...
...
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