Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
site-kwei
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aeltheos
site-kwei
Commits
dbc4f4a6
Commit
dbc4f4a6
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Switch to class based views
parent
b252379e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
home/urls.py
+3
-3
3 additions, 3 deletions
home/urls.py
home/views.py
+22
-4
22 additions, 4 deletions
home/views.py
with
25 additions
and
7 deletions
home/urls.py
+
3
−
3
View file @
dbc4f4a6
...
...
@@ -7,10 +7,10 @@ from home import views
sitemaps
=
{
"
static_pages
"
:
views
.
StaticViewSitemap
}
urlpatterns
=
[
path
(
''
,
views
.
static
_view
,
{
"
template
"
:
"
home.html
"
},
name
=
'
home
'
),
path
(
''
,
views
.
HomeView
.
as
_view
()
,
{
"
template
"
:
"
home.html
"
},
name
=
'
home
'
),
path
(
'
inscription/
'
,
views
.
sign_up
,
name
=
'
inscription
'
),
path
(
'
activites/
'
,
views
.
static
_view
,
{
"
template
"
:
"
activites.html
"
},
name
=
'
activites
'
),
path
(
'
faq/
'
,
views
.
static
_view
,
{
"
template
"
:
"
faq.html
"
},
name
=
'
FAQ
'
),
path
(
'
activites/
'
,
views
.
ActivityView
.
as
_view
()
,
{
"
template
"
:
"
activites.html
"
},
name
=
'
activites
'
),
path
(
'
faq/
'
,
views
.
FAQView
.
as
_view
()
,
{
"
template
"
:
"
faq.html
"
},
name
=
'
FAQ
'
),
path
(
'
favicon.ico
'
,
RedirectView
.
as_view
(
url
=
'
/static/imgs/favicon.ico
'
)),
path
(
'
sitemap.xml
'
,
sitemap
,
{
'
sitemaps
'
:
sitemaps
},
...
...
This diff is collapsed.
Click to expand it.
home/views.py
+
22
−
4
View file @
dbc4f4a6
...
...
@@ -2,13 +2,31 @@ from django.conf import settings
from
django.contrib.sitemaps
import
Sitemap
from
django.shortcuts
import
redirect
,
render
from
django.urls
import
reverse
from
django.views.generic
import
TemplateView
from
home.models
import
InterludesActivity
def
static_view
(
request
,
template
):
"""
Simple vues statique (rendu html)
"""
activities
=
InterludesActivity
.
objects
.
filter
(
display
=
True
).
order_by
(
"
title
"
)
return
render
(
request
,
template
,
{
'
activities
'
:
activities
})
class
HomeView
(
TemplateView
):
"""
Vue pour la page d
'
acceuil
"""
template_name
=
"
home.html
"
class
ActivityView
(
TemplateView
):
"""
Vue pour la liste des activités
"""
template_name
=
"
activites.html
"
def
get_context_data
(
self
,
**
kwargs
):
"""
ajoute la liste des activités au contexte
"""
context
=
super
(
ActivityView
,
self
).
get_context_data
(
**
kwargs
)
context
[
'
activities
'
]
=
InterludesActivity
.
objects
.
filter
(
display
=
True
).
order_by
(
"
title
"
)
return
context
class
FAQView
(
TemplateView
):
"""
Vue pour la FAQ
"""
template_name
=
"
faq.html
"
def
sign_up
(
request
):
"""
Page d
'
inscription
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment