Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_jupert
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
Joseph Izon
widget_jupert
Commits
6551c896
Commit
6551c896
authored
May 27, 2022
by
Joseph Izon
💀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert index view from FBV to CBV
parent
6fc1d708
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
db.sqlite3
widget_jupert/db.sqlite3
+0
-0
urls.py
widget_jupert/homepage/urls.py
+2
-1
views.py
widget_jupert/homepage/views.py
+11
-1
No files found.
widget_jupert/db.sqlite3
View file @
6551c896
No preview for this file type
widget_jupert/homepage/urls.py
View file @
6551c896
...
@@ -3,10 +3,11 @@ from django.conf.urls.static import static
...
@@ -3,10 +3,11 @@ from django.conf.urls.static import static
from
django.conf
import
settings
from
django.conf
import
settings
from
.
import
views
from
.
import
views
from
.views
import
IndexView
app_name
=
"homepages"
app_name
=
"homepages"
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
),
path
(
''
,
IndexView
.
as_view
()
,
name
=
'index'
),
# homepage/id_num
# homepage/id_num
path
(
"users/<int:id_num>/details"
,
views
.
detail
,
name
=
"detail"
),
path
(
"users/<int:id_num>/details"
,
views
.
detail
,
name
=
"detail"
),
...
...
widget_jupert/homepage/views.py
View file @
6551c896
from
urllib
import
response
from
urllib
import
response
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
django.views
import
View
from
homepage.models
import
WidgetUser
from
homepage.models
import
WidgetUser
from
.forms
import
WidgetUserForm
from
.forms
import
WidgetUserForm
# Create your views here.
# Create your views here.
def
index
(
request
):
"""def index(request):
user_list = WidgetUser.objects.order_by("last_name")
user_list = WidgetUser.objects.order_by("last_name")
...
@@ -15,6 +17,14 @@ def index(request):
...
@@ -15,6 +17,14 @@ def index(request):
}
}
return render(request, "homepage/index.html", context)
return render(request, "homepage/index.html", context)
"""
class
IndexView
(
View
):
def
get
(
self
,
request
):
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"user_list"
:
user_list
,
}
return
render
(
request
,
"homepage/index.html"
,
context
)
def
detail
(
request
,
id_num
):
def
detail
(
request
,
id_num
):
...
...
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