Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lopez-django-lab-1
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
Jay Lopez
lopez-django-lab-1
Commits
64086d88
Commit
64086d88
authored
Mar 07, 2020
by
Jay Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to use function-based views
parent
fd940423
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
17 deletions
+8
-17
urls.cpython-37.pyc
heroes/__pycache__/urls.cpython-37.pyc
+0
-0
views.cpython-37.pyc
heroes/__pycache__/views.cpython-37.pyc
+0
-0
urls.py
heroes/urls.py
+4
-4
views.py
heroes/views.py
+4
-13
No files found.
heroes/__pycache__/urls.cpython-37.pyc
View file @
64086d88
No preview for this file type
heroes/__pycache__/views.cpython-37.pyc
View file @
64086d88
No preview for this file type
heroes/urls.py
View file @
64086d88
...
...
@@ -2,8 +2,8 @@ from django.conf.urls import url
from
.views
import
*
urlpatterns
=
[
url
(
r'^heroes$'
,
HomeView
.
as_view
(),
name
=
'index'
),
url
(
r'^hero/
cloud$'
,
CloudView
.
as_view
()
),
url
(
r'^hero/
sunflowey$'
,
SunfloweyView
.
as_view
()
),
url
(
r'^hero/
jester$'
,
JesterView
.
as_view
()
)
url
(
r'^heroes$'
,
home_page
),
url
(
r'^hero/
(cloud)$'
,
detail_page
),
url
(
r'^hero/
(sunflowey)$'
,
detail_page
),
url
(
r'^hero/
(jester)$'
,
detail_page
)
]
\ No newline at end of file
heroes/views.py
View file @
64086d88
...
...
@@ -3,17 +3,8 @@ from django.views.generic.base import TemplateView
# Create your views here.
class
HomeView
(
TemplateView
):
template_name
=
'index.html'
def
home_page
(
request
):
return
render
(
request
,
'index.html'
)
class
CloudView
(
TemplateView
):
template_name
=
'detail_cloud.html'
class
JesterView
(
TemplateView
):
template_name
=
'detail_jester.html'
class
SunfloweyView
(
TemplateView
):
template_name
=
'detail_sunflowey.html'
\ No newline at end of file
def
detail_page
(
request
,
name
):
return
render
(
request
,
'detail_'
+
name
+
'.html'
)
\ No newline at end of file
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