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
mediatek
site-kwei
Commits
c5256131
Commit
c5256131
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Added fields to models
parent
08241e99
No related branches found
Branches containing commit
Tags
v1.2.6
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
home/admin.py
+8
-7
8 additions, 7 deletions
home/admin.py
home/models.py
+27
-10
27 additions, 10 deletions
home/models.py
site_settings/models.py
+2
-0
2 additions, 0 deletions
site_settings/models.py
with
37 additions
and
17 deletions
home/admin.py
+
8
−
7
View file @
c5256131
...
...
@@ -28,25 +28,25 @@ class ExportCsvMixin:
export_as_csv
.
short_description
=
"
Exporter au format CSV
"
actions
=
[
"
export_as_csv
"
]
@admin.register
(
InterludesActivity
)
class
InterludesActivityAdmin
(
admin
.
ModelAdmin
,
ExportCsvMixin
):
"""
option d
'
affichage des activités dans la vue django admin
"""
list_display
=
(
"
title
"
,
"
host_name
"
,
"
display
"
,
"
must_subscribe
"
,)
list_filter
=
(
"
display
"
,
"
must_subscribe
"
,)
list_display
=
(
"
title
"
,
"
host_name
"
,
"
display
"
,
"
must_subscribe
"
,
"
on_planning
"
)
list_filter
=
(
"
display
"
,
"
must_subscribe
"
,
"
on_planning
"
)
ordering
=
(
"
title
"
,
"
host_name
"
,)
list_editable
=
(
"
display
"
,)
list_per_page
=
100
actions
=
[
"
export_as_csv
"
]
@admin.register
(
InterludesParticipant
)
class
InterludesParticipantAdmin
(
admin
.
ModelAdmin
,
ExportCsvMixin
):
"""
option d
'
affichage des participant dans la vue django admin
"""
list_display
=
(
"
name
"
,
"
school
"
,)
list_filter
=
(
"
school
"
,)
ordering
=
(
"
name
"
,)
list_display
=
(
"
user
"
,
"
school
"
,
"
is_registered
"
)
list_filter
=
(
"
school
"
,
"
is_registered
"
)
ordering
=
(
"
user
"
,)
list_per_page
=
200
actions
=
[
"
export_as_csv
"
]
@admin.register
(
ActivityList
)
class
ActivityListAdmin
(
admin
.
ModelAdmin
,
ExportCsvMixin
):
...
...
@@ -55,3 +55,4 @@ class ActivityListAdmin(admin.ModelAdmin, ExportCsvMixin):
list_filter
=
(
"
activity
"
,
"
participant
"
,)
ordering
=
(
"
participant
"
,
"
priority
"
,)
list_per_page
=
200
actions
=
[
"
export_as_csv
"
]
This diff is collapsed.
Click to expand it.
home/models.py
+
27
−
10
View file @
c5256131
...
...
@@ -13,11 +13,16 @@ class InterludesActivity(models.Model):
min_paricipants
=
models
.
PositiveIntegerField
(
"
Nombre minimum de participants
"
)
display
=
models
.
BooleanField
(
"
Afficher cette activité
"
,
default
=
False
)
must_subscribe
=
models
.
BooleanField
(
"
Sur inscription
"
,
default
=
False
)
host_name
=
models
.
CharField
(
"
Nom de l
'
organisateur
"
,
max_length
=
50
)
host_email
=
models
.
EmailField
(
"
Email de l
'
organisateur
"
)
description
=
models
.
TextField
(
"
Description
"
,
max_length
=
2000
)
display
=
models
.
BooleanField
(
"
afficher cette activité
"
,
default
=
False
)
must_subscribe
=
models
.
BooleanField
(
"
sur inscription
"
,
default
=
False
)
host_name
=
models
.
CharField
(
"
nom de l
'
organisateur
"
,
max_length
=
50
)
host_email
=
models
.
EmailField
(
"
email de l
'
organisateur
"
)
description
=
models
.
TextField
(
"
description
"
,
max_length
=
2000
)
on_planning
=
models
.
BooleanField
(
"
afficher sur le planning
"
,
default
=
False
)
start
=
models
.
DateTimeField
(
"
début
"
,
null
=
True
,
blank
=
True
)
room
=
models
.
CharField
(
"
salle
"
,
max_length
=
100
,
null
=
True
,
blank
=
True
)
notes
=
models
.
TextField
(
"
Notes privées
"
,
max_length
=
2000
)
@property
...
...
@@ -44,12 +49,23 @@ class InterludesParticipant(models.Model):
ENS_CACHAN
=
"
C
"
,
_
(
"
ENS Paris Saclay
"
)
user
=
models
.
OneToOneField
(
EmailUser
,
on_delete
=
models
.
CASCADE
,
related_name
=
"
Utilisateur
"
)
name
=
models
.
CharField
(
"
Nom complet
"
,
max_length
=
200
)
email
=
models
.
EmailField
(
"
email
"
)
school
=
models
.
CharField
(
"
ENS de rattachement
"
,
choices
=
ENS
.
choices
,
max_length
=
1
)
is_registered
=
models
.
BooleanField
(
"
est inscrit
"
,
default
=
False
)
meal_friday_evening
=
models
.
BooleanField
(
"
repas de vendredi soir
"
,
default
=
False
)
meal_saturday_morning
=
models
.
BooleanField
(
"
repas de samedi matin
"
,
default
=
False
)
meal_saturday_midday
=
models
.
BooleanField
(
"
repas de samedi midi
"
,
default
=
False
)
meal_saturday_evening
=
models
.
BooleanField
(
"
repas de samedi soir
"
,
default
=
False
)
meal_sunday_morning
=
models
.
BooleanField
(
"
repas de dimanche matin
"
,
default
=
False
)
meal_sunday_midday
=
models
.
BooleanField
(
"
repas de dimanche soir
"
,
default
=
False
)
sleeps
=
models
.
BooleanField
(
"
dormir sur place
"
,
default
=
False
)
mug
=
models
.
BooleanField
(
"
commander une tasse
"
,
default
=
False
)
def
__str__
(
self
)
->
str
:
return
"
{} ({})
"
.
format
(
self
.
name
,
self
.
school
)
return
"
{}
{}
({})
"
.
format
(
self
.
user
.
first_name
,
self
.
user
.
last_
name
,
self
.
school
)
class
Meta
:
verbose_name
=
"
participant
"
...
...
@@ -65,10 +81,11 @@ class ActivityList(models.Model):
activity
=
models
.
ForeignKey
(
InterludesActivity
,
on_delete
=
models
.
CASCADE
,
db_column
=
"
activité
"
)
accepted
=
models
.
BooleanField
(
default
=
False
)
class
Meta
:
#
le
couple
participant, priority est
unique
unique_together
=
((
"
priority
"
,
"
participant
"
))
# couple
s
unique
s
unique_together
=
((
"
priority
"
,
"
participant
"
)
,
(
"
participant
"
,
"
activity
"
)
)
ordering
=
(
"
participant
"
,
"
priority
"
)
verbose_name
=
"
choix d
'
activités
"
verbose_name_plural
=
"
choix d
'
activités
"
This diff is collapsed.
Click to expand it.
site_settings/models.py
+
2
−
0
View file @
c5256131
...
...
@@ -39,6 +39,8 @@ class SiteSettings(SingletonModel):
registrations_open
=
models
.
BooleanField
(
"
Ouvrir la création de compte
"
,
default
=
False
)
inscriptions_open
=
models
.
BooleanField
(
"
Ouvrir les inscriptions
"
,
default
=
False
)
display_planning
=
models
.
BooleanField
(
"
Afficher le planning
"
,
default
=
False
)
class
Meta
:
verbose_name
=
"
paramètres
"
...
...
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