Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_someone here is possessed by an owl
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
Laetitia de Castro
widget_someone here is possessed by an owl
Commits
38c53623
Commit
38c53623
authored
May 26, 2022
by
Rurik Serzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed index from fbv to cbv
parent
e44b4009
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
urls.cpython-310.pyc
forum/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
forum/__pycache__/views.cpython-310.pyc
+0
-0
urls.py
forum/urls.py
+2
-2
views.py
forum/views.py
+8
-6
No files found.
forum/__pycache__/urls.cpython-310.pyc
View file @
38c53623
No preview for this file type
forum/__pycache__/views.cpython-310.pyc
View file @
38c53623
No preview for this file type
forum/urls.py
View file @
38c53623
from
django.urls
import
path
from
.views
import
index
,
PostDetailView
,
new_post
from
.views
import
IndexView
,
PostDetailView
,
new_post
urlpatterns
=
[
path
(
""
,
index
,
name
=
"index"
),
path
(
""
,
IndexView
.
as_view
()
,
name
=
"index"
),
path
(
"<int:pk>/details"
,
PostDetailView
.
as_view
(),
name
=
"post-detail"
),
path
(
"add"
,
new_post
,
name
=
"new-post"
)
]
...
...
forum/views.py
View file @
38c53623
...
...
@@ -2,11 +2,13 @@ from django.shortcuts import render, redirect
from
django.http
import
HttpResponse
from
django.template
import
loader
from
django.views.generic.detail
import
DetailView
from
django.views.generic.base
import
TemplateView
from
.models
import
Post
,
Reply
from
.forms
import
PostForm
def
index
(
request
):
class
IndexView
(
TemplateView
):
def
get
(
self
,
request
):
context
=
{
"posts"
:
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