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
d7f00ef2
Commit
d7f00ef2
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Added metrics
parent
3c9c2680
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
accounts/views.py
+4
-0
4 additions, 0 deletions
accounts/views.py
home/static/css/style.css
+23
-0
23 additions, 0 deletions
home/static/css/style.css
home/urls.py
+1
-0
1 addition, 0 deletions
home/urls.py
home/views.py
+53
-1
53 additions, 1 deletion
home/views.py
shared/views.py
+9
-2
9 additions, 2 deletions
shared/views.py
with
90 additions
and
3 deletions
accounts/views.py
+
4
−
0
View file @
d7f00ef2
...
...
@@ -69,6 +69,10 @@ class ProfileView(LoginRequiredMixin, TemplateView):
return
context
# ==============================
# Create Account
# ==============================
class
CreateAccountView
(
View
):
"""
Vue pour la creation de compte
"""
...
...
This diff is collapsed.
Click to expand it.
home/static/css/style.css
+
23
−
0
View file @
d7f00ef2
...
...
@@ -146,6 +146,25 @@ main a:link {
text-decoration
:
underline
;
color
:
rgb
(
62
,
62
,
255
);
}
.lines
{
border-top
:
2px
solid
#333
;
border-bottom
:
2px
solid
#333
;
justify-content
:
left
}
.stat
{
min-width
:
120px
;
text-align
:
center
;
padding
:
5px
;
}
.stat
.qty
{
font-size
:
1.2em
;
}
.stat
.nb_big
{
font-size
:
3em
;
}
.stat
.nb_small
{
font-size
:
2em
;
}
dl
{
list-style
:
none
;
...
...
@@ -173,6 +192,10 @@ span.helptext {
.flex
{
display
:
flex
;
}
.wrap
{
flex-flow
:
row
wrap
;
flex-wrap
:
wrap
;
}
.antispam
{
unicode-bidi
:
bidi-override
;
...
...
This diff is collapsed.
Click to expand it.
home/urls.py
+
1
−
0
View file @
d7f00ef2
...
...
@@ -13,6 +13,7 @@ urlpatterns = [
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
(
'
metrics/
'
,
views
.
MetricsView
.
as_view
(),
name
=
"
metrics
"
),
path
(
'
sitemap.xml
'
,
sitemap
,
{
'
sitemaps
'
:
sitemaps
},
name
=
'
django.contrib.sitemaps.views.sitemap
'
...
...
This diff is collapsed.
Click to expand it.
home/views.py
+
53
−
1
View file @
d7f00ef2
...
...
@@ -6,9 +6,16 @@ from django.shortcuts import redirect, render
from
django.urls
import
reverse
from
django.views.generic
import
RedirectView
,
UpdateView
,
TemplateView
,
View
from
home.models
import
ActivityList
,
InterludesActivity
from
accounts.models
import
EmailUser
from
home.models
import
ActivityList
,
InterludesActivity
,
InterludesParticipant
from
home.forms
import
ActivityForm
,
BaseActivityFormSet
,
InscriptionForm
from
site_settings.models
import
SiteSettings
from
shared.views
import
SuperuserRequiredMixin
# ==============================
# Site static pages
# ==============================
class
HomeView
(
TemplateView
):
...
...
@@ -32,6 +39,11 @@ class FAQView(TemplateView):
template_name
=
"
faq.html
"
# ==============================
# Registration
# ==============================
class
RegisterClosed
(
TemplateView
):
"""
Vue pour quand les inscriptions ne sont pas ouvertes
"""
template_name
=
"
inscription/closed.html
"
...
...
@@ -109,6 +121,46 @@ class UnregisterView(LoginRequiredMixin, RedirectView):
return
reverse
(
self
.
pattern_name
)
# ==============================
# Admin views
# ==============================
class
MetricsView
(
SuperuserRequiredMixin
,
TemplateView
):
template_name
=
"
metrics.html
"
def
get_metrics
(
self
):
registered
=
InterludesParticipant
.
objects
.
filter
(
is_registered
=
True
)
class
metrics
:
participants
=
registered
.
count
()
ulm
=
registered
.
filter
(
school
=
"
U
"
).
count
()
lyon
=
registered
.
filter
(
school
=
"
L
"
).
count
()
rennes
=
registered
.
filter
(
school
=
"
R
"
).
count
()
saclay
=
registered
.
filter
(
school
=
"
P
"
).
count
()
non_registered
=
EmailUser
.
objects
.
filter
(
is_active
=
True
).
count
()
-
participants
meal1
=
registered
.
filter
(
meal_friday_evening
=
True
).
count
()
meal2
=
registered
.
filter
(
meal_saturday_morning
=
True
).
count
()
meal3
=
registered
.
filter
(
meal_saturday_midday
=
True
).
count
()
meal4
=
registered
.
filter
(
meal_saturday_evening
=
True
).
count
()
meal5
=
registered
.
filter
(
meal_sunday_morning
=
True
).
count
()
meal6
=
registered
.
filter
(
meal_sunday_midday
=
True
).
count
()
meals
=
meal1
+
meal2
+
meal3
+
meal4
+
meal5
+
meal6
mugs
=
registered
.
filter
(
mug
=
True
).
count
()
sleeps
=
registered
.
filter
(
sleeps
=
True
).
count
()
return
metrics
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
().
get_context_data
(
*
args
,
**
kwargs
)
context
[
"
metrics
"
]
=
self
.
get_metrics
()
return
context
# ==============================
# Sitemap
# ==============================
class
StaticViewSitemap
(
Sitemap
):
"""
Vue générant la sitemap.xml du site
"""
changefreq
=
'
monthly
'
...
...
This diff is collapsed.
Click to expand it.
shared/views.py
+
9
−
2
View file @
d7f00ef2
from
django.
shortcuts
import
render
from
django.
contrib.auth.mixins
import
UserPassesTestMixin
# Create your views here.
class
SuperuserRequiredMixin
(
UserPassesTestMixin
):
"""
Classe restreignant l
'
accès d
'
une vue aux superusers
"""
raise_exception
=
True
permission_denied_message
=
"
Seul les superutilisateurs ont accès à cette page
"
def
test_func
(
self
):
user
=
self
.
request
.
user
return
user
.
is_authenticated
and
user
.
is_superuser
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