forked from DGNum/gestioCOF
Compare commits
229 commits
thubrecht/
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
2126224e15 | ||
|
d6109a9312 | ||
|
a69bd0426f | ||
|
81a4dbef7c | ||
|
4fedf3453d | ||
|
8607d77c84 | ||
|
bc55a3067e | ||
|
dd68ad91cd | ||
|
2f71246509 | ||
|
a20a1c11d6 | ||
|
0e1ff1765a | ||
|
177d413f4c | ||
|
01dd16c795 | ||
|
84c87c1b4b | ||
|
1b143b322f | ||
|
f9456e3c29 | ||
|
dd1350f1c2 | ||
|
8f4cb68d31 | ||
|
3a3f96a8df | ||
|
7d8926e459 | ||
|
3fee014384 | ||
|
cd351786bb | ||
|
7362c2fa2a | ||
|
efbc947145 | ||
|
0c45262fbc | ||
|
cabd277b4a | ||
|
4108efe8c9 | ||
|
693e4252d5 | ||
|
3aa928e8f0 | ||
|
5e2e68960b | ||
|
91e9beee11 | ||
|
ac286209ed | ||
|
b03cda5962 | ||
|
4feb567af7 | ||
|
1ac47885d0 | ||
|
071c810605 | ||
|
7f00ce0ff1 | ||
|
95136cb4eb | ||
|
e299997aa8 | ||
|
40f34926bb | ||
|
69976a878a | ||
|
6621ae3950 | ||
|
9288daaf9e | ||
|
e92c500940 | ||
|
d75eaf583f | ||
|
55bd3ab51d | ||
|
f640a25f59 | ||
|
f881c7cd8b | ||
|
b548b87c25 | ||
|
a72302291f | ||
|
a0bde75f50 | ||
|
44b19c12e5 | ||
|
f97d339a1c | ||
|
094116e88d | ||
|
b32a07fc22 | ||
|
4fc9902cf6 | ||
|
7164cfa37a | ||
|
90f96fb5c9 | ||
|
e50249355d | ||
|
c304d734d9 | ||
|
c36dd30bce | ||
|
2571cc955e | ||
|
3eaac5c68f | ||
|
af4c8e0744 | ||
|
14e0a3ef0a | ||
|
83078d4726 | ||
|
cb262ad479 | ||
|
5c47118834 | ||
|
30e842ce80 | ||
|
892bf51163 | ||
|
e20d7ca6c2 | ||
|
1b09293206 | ||
|
e7da476697 | ||
|
761ab6df90 | ||
|
a8d4035d33 | ||
|
b80426c56f | ||
|
429e611daa | ||
|
5160da7862 | ||
|
aad3775222 | ||
|
4b92716092 | ||
|
dfa5b4bf69 | ||
|
1be5dcb6af | ||
|
a891ec56a6 | ||
|
7a52690a63 | ||
|
a2f396ce7a | ||
|
85e30056a6 | ||
|
69de48f285 | ||
|
eba36f2712 | ||
|
bfdb34aae7 | ||
|
fcf2002cd7 | ||
|
b236d6a950 | ||
|
4b29097f02 | ||
|
87f383bef1 | ||
|
1ad025e046 | ||
|
b3c047738a | ||
|
17a9ae3302 | ||
|
e41bcbb6d7 | ||
|
e384bfb0f3 | ||
|
373ff1f62c | ||
|
65eb95a3c9 | ||
|
1c880b265e | ||
|
75fbdc7efb | ||
|
1b8dd971b0 | ||
|
713d686047 | ||
|
77aa269c90 | ||
|
9a143521d5 | ||
|
a77cf59b18 | ||
|
d8cabda678 | ||
|
f086140dad | ||
|
4d1ae8f540 | ||
|
6d824a58be | ||
|
20880114aa | ||
|
df180d7446 | ||
|
ef1793a348 | ||
|
2d677b2093 | ||
|
f70eacfc37 | ||
|
264a0a852f | ||
|
7ca7f7298a | ||
|
a5c822e7f7 | ||
|
6b316c482b | ||
|
4060730ec5 | ||
|
c6cfc311e0 | ||
|
4326ba9016 | ||
|
4205e0ad0e | ||
|
964eec6ab1 | ||
|
29236e0b0e | ||
|
1939a54fef | ||
|
348881d207 | ||
|
ef8c1b8bf2 | ||
|
8743301105 | ||
|
6a11139588 | ||
|
a34b83c236 | ||
|
02584982f6 | ||
|
7bf0c5f09e | ||
|
b9aaf6a19c | ||
|
16dee0c143 | ||
|
a947b9d3f2 | ||
|
93d283fecb | ||
|
63738e8e02 | ||
|
1e44550e12 | ||
|
4136cb6868 | ||
|
99809209e0 | ||
|
0351f6728b | ||
|
7efc7e6b94 | ||
|
7d21a5a1fc | ||
|
dba785bf13 | ||
|
71878caf2c | ||
|
db42028228 | ||
|
7171a7567c | ||
|
339223bec0 | ||
|
d62a8d61de | ||
|
f6c83dc692 | ||
|
a984d1fd6f | ||
|
f901ea9396 | ||
|
17d96f1775 | ||
|
c10e5fe45c | ||
|
9bbe3f50cb | ||
|
1f4a4ec76f | ||
|
2befa584aa | ||
|
b48d32f4bc | ||
|
e36e88e77a | ||
|
8e9fc341ca | ||
|
c14c2d54a5 | ||
|
6adfaba8e9 | ||
|
06005014f9 | ||
|
4268a30d51 | ||
|
c71e6d22bf | ||
|
4df3ef4dd9 | ||
|
af95e64344 | ||
|
ac8ad15ad1 | ||
|
47dd078b6a | ||
|
472a44c30f | ||
|
b72ea9ebf9 | ||
|
f9958e4da0 | ||
|
47f406e09e | ||
|
1450b65dcd | ||
|
aac94afcd0 | ||
|
209360f535 | ||
|
b224fedf28 | ||
|
1ab071d16e | ||
|
1cf6f6f3e7 | ||
|
a421bec625 | ||
|
4e758fbba0 | ||
|
2350109a33 | ||
|
778637d60e | ||
|
23f7865140 | ||
|
cc7c4306f4 | ||
|
1183e50f60 | ||
|
a8de7e0ae0 | ||
|
30a39ef2f6 | ||
|
9a635148bb | ||
|
4b95b65be2 | ||
|
884ec2535b | ||
|
beba3052dd | ||
|
46242ad2c0 | ||
|
fa8c57269c | ||
|
b97bc8bfa8 | ||
|
89fc309c01 | ||
|
d7367476bc | ||
|
7297baaf7e | ||
|
8bf7914728 | ||
|
71fbbcff8a | ||
|
9303772f9a | ||
|
559b36b6f0 | ||
|
fbafdb7134 | ||
|
a53bd94737 | ||
|
46ef12309a | ||
|
4f60ba35eb | ||
|
f29b3f0187 | ||
|
aa3462aaee | ||
|
7c35357060 | ||
|
726b3f55a0 | ||
|
63eeb5b7a9 | ||
|
7081380058 | ||
|
288de95c49 | ||
|
9a01d1e877 | ||
|
10746c0469 | ||
|
5c8eca15b6 | ||
|
ef64f9ce5c | ||
|
9762838921 | ||
|
bf6d6d6430 | ||
|
ba9aa06b4f | ||
|
880dc31353 | ||
|
9a78fca507 | ||
|
4bc56d34e0 | ||
|
79f0757e9f | ||
|
a2eed13717 | ||
|
830aba984e | ||
|
49fde85187 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,6 +5,7 @@ cof/settings.py
|
||||||
settings.py
|
settings.py
|
||||||
*~
|
*~
|
||||||
venv/
|
venv/
|
||||||
|
.venv/
|
||||||
.vagrant
|
.vagrant
|
||||||
/src
|
/src
|
||||||
media/
|
media/
|
||||||
|
@ -19,3 +20,4 @@ media/
|
||||||
|
|
||||||
# VSCode
|
# VSCode
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.direnv
|
||||||
|
|
|
@ -17,12 +17,15 @@ variables:
|
||||||
# psql password authentication
|
# psql password authentication
|
||||||
PGPASSWORD: $POSTGRES_PASSWORD
|
PGPASSWORD: $POSTGRES_PASSWORD
|
||||||
|
|
||||||
|
# apps to check migrations for
|
||||||
|
MIGRATION_APPS: "bda bds cofcms clubs events gestioncof kfet kfetauth kfetcms open petitscours shared"
|
||||||
|
|
||||||
.test_template:
|
.test_template:
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p vendor/{pip,apt}
|
- mkdir -p vendor/{pip,apt}
|
||||||
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
||||||
- sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' cof/settings/secret_example.py > cof/settings/secret.py
|
- sed -E 's/^REDIS_HOST.*/REDIS_HOST = "redis"/' gestioasso/settings/secret_example.py > gestioasso/settings/secret.py
|
||||||
- sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' cof/settings/secret.py
|
- sed -i.bak -E 's;^REDIS_PASSWD = .*$;REDIS_PASSWD = "";' gestioasso/settings/secret.py
|
||||||
# Remove the old test database if it has not been done yet
|
# Remove the old test database if it has not been done yet
|
||||||
- psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB"
|
- psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB"
|
||||||
- pip install --upgrade -r requirements-prod.txt coverage tblib
|
- pip install --upgrade -r requirements-prod.txt coverage tblib
|
||||||
|
@ -40,19 +43,27 @@ variables:
|
||||||
# Keep this disabled for now, as it may kill GitLab...
|
# Keep this disabled for now, as it may kill GitLab...
|
||||||
# coverage: '/TOTAL.*\s(\d+\.\d+)\%$/'
|
# coverage: '/TOTAL.*\s(\d+\.\d+)\%$/'
|
||||||
|
|
||||||
|
kfettest:
|
||||||
|
stage: test
|
||||||
|
extends: .test_template
|
||||||
|
variables:
|
||||||
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod"
|
||||||
|
script:
|
||||||
|
- coverage run manage.py test kfet
|
||||||
|
|
||||||
coftest:
|
coftest:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_template
|
extends: .test_template
|
||||||
variables:
|
variables:
|
||||||
DJANGO_SETTINGS_MODULE: "cof.settings.cof_prod"
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod"
|
||||||
script:
|
script:
|
||||||
- coverage run manage.py test gestioncof bda kfet petitscours shared --parallel
|
- coverage run manage.py test gestioncof bda petitscours shared --parallel
|
||||||
|
|
||||||
bdstest:
|
bdstest:
|
||||||
stage: test
|
stage: test
|
||||||
extends: .test_template
|
extends: .test_template
|
||||||
variables:
|
variables:
|
||||||
DJANGO_SETTINGS_MODULE: "cof.settings.bds_prod"
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.bds_prod"
|
||||||
script:
|
script:
|
||||||
- coverage run manage.py test bds clubs events --parallel
|
- coverage run manage.py test bds clubs events --parallel
|
||||||
|
|
||||||
|
@ -65,7 +76,7 @@ linters:
|
||||||
- black --check .
|
- black --check .
|
||||||
- isort --check --diff .
|
- isort --check --diff .
|
||||||
# Print errors only
|
# Print errors only
|
||||||
- flake8 --exit-zero bda bds clubs cof events gestioncof kfet petitscours provisioning shared
|
- flake8 --exit-zero bda bds clubs gestioasso events gestioncof kfet petitscours provisioning shared
|
||||||
cache:
|
cache:
|
||||||
key: linters
|
key: linters
|
||||||
paths:
|
paths:
|
||||||
|
@ -75,14 +86,14 @@ linters:
|
||||||
migration_checks:
|
migration_checks:
|
||||||
stage: test
|
stage: test
|
||||||
variables:
|
variables:
|
||||||
DJANGO_SETTINGS_MODULE: "cof.settings.local"
|
DJANGO_SETTINGS_MODULE: "gestioasso.settings.local"
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p vendor/{pip,apt}
|
- mkdir -p vendor/{pip,apt}
|
||||||
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq postgresql-client libldap2-dev libsasl2-dev
|
||||||
- cp cof/settings/secret_example.py cof/settings/secret.py
|
- cp gestioasso/settings/secret_example.py gestioasso/settings/secret.py
|
||||||
- pip install --upgrade -r requirements-devel.txt
|
- pip install --upgrade -r requirements-devel.txt
|
||||||
- python --version
|
- python --version
|
||||||
script: python manage.py makemigrations --dry-run --check
|
script: python manage.py makemigrations --dry-run --check $MIGRATION_APPS
|
||||||
services:
|
services:
|
||||||
# this should not be necessary…
|
# this should not be necessary…
|
||||||
- postgres:11.7
|
- postgres:11.7
|
||||||
|
|
113
CHANGELOG.md
113
CHANGELOG.md
|
@ -21,13 +21,122 @@ Liste des changements notables dans GestioCOF depuis la version 0.1 (septembre
|
||||||
Uniquement un modèle simple de clubs avec des respos. Aucune gestion des
|
Uniquement un modèle simple de clubs avec des respos. Aucune gestion des
|
||||||
adhérents ni des cotisations.
|
adhérents ni des cotisations.
|
||||||
|
|
||||||
## Version ??? - dans un futur proche
|
## TODO Prod
|
||||||
|
|
||||||
|
- Lancer `python manage.py update_translation_fields` après la migration
|
||||||
|
- Mettre à jour les units systemd `daphne.service` et `worker.service`
|
||||||
|
|
||||||
|
- Créer un compte hCaptcha (https://www.hcaptcha.com/), au COF, et remplacer les secrets associés
|
||||||
|
|
||||||
|
## Version ??? - ??/??/????
|
||||||
|
|
||||||
|
## Version 0.15.1 - 15/06/2023
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Rattrape les erreurs d'envoi de mail de négatif
|
||||||
|
- Utilise l'adresse chefs pour les envois de négatifs
|
||||||
|
|
||||||
|
## Version 0.15 - 22/05/2023
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Rajoute un formulaire de contact
|
||||||
|
- Rajoute un formulaire de demande de soirée
|
||||||
|
- Désactive les mails d'envoi de négatifs sur les comptes gelés
|
||||||
|
|
||||||
|
## Version 0.14 - 19/05/2023
|
||||||
|
|
||||||
|
- Répare les dépendances en spécifiant toutes les versions
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Répare la gestion des changement d'heure via moment.js
|
||||||
|
|
||||||
|
## Version 0.13 - 19/02/2023
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Rajoute la valeur des inventaires
|
||||||
|
- Résout les problèmes de négatif ne disparaissant pas
|
||||||
|
- Affiche son surnom s'il y en a un
|
||||||
|
- Bugfixes
|
||||||
|
|
||||||
|
## Version 0.12.1 - 03/10/2022
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Fixe un problème de rendu causé par l'agrandissement du menu
|
||||||
|
|
||||||
|
- Mise à jour vers Channels 3.x et Django 3.2
|
||||||
|
|
||||||
|
## Version 0.12 - 17/06/2022
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Ajoute une exception à la limite d'historique pour les comptes `LIQ` et `#13`
|
||||||
|
- Répare le problème des étiquettes LIQ/Comptes K-Fêt inversées dans les stats des articles K-Fêt
|
||||||
|
|
||||||
|
## Version 0.11 - 26/10/2021
|
||||||
|
|
||||||
|
### COF
|
||||||
|
|
||||||
|
- Répare un problème de rendu sur le wagtail du COF
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- Ajoute de mails de rappels pour les comptes en négatif
|
||||||
|
- La recherche de comptes sur K-Psul remarche normalement
|
||||||
|
- Le pointeur de la souris change de forme quand on survole un item d'autocomplétion
|
||||||
|
- Modification du gel de compte:
|
||||||
|
- on ne peut plus geler/dégeler son compte soi-même (il faut la permission "Gérer les permissions K-Fêt")
|
||||||
|
- on ne peut rien compter sur un compte gelé (aucune override possible), et les K-Fêteux·ses dont le compte est gelé perdent tout accès à K-Psul
|
||||||
|
- les comptes actuellement gelés (sur l'ancien système) sont dégelés automatiquement
|
||||||
|
- Modification du fonctionnement des négatifs
|
||||||
|
- impossible d'avoir des négatifs inférieurs à `kfet_config.overdraft_amount`
|
||||||
|
- il n'y a plus de limite de temps sur les négatifs
|
||||||
|
- supression des autorisations de négatif
|
||||||
|
- il n'est plus possible de réinitialiser la durée d'un négatif en faisant puis en annulant une charge
|
||||||
|
- La gestion des erreurs passe du client au serveur, ce qui permet d'avoir des messages plus explicites
|
||||||
|
- La supression d'opérations anciennes est réparée
|
||||||
|
|
||||||
|
## Version 0.10 - 18/04/2021
|
||||||
|
|
||||||
|
### K-Fêt
|
||||||
|
|
||||||
|
- On fait sauter la limite qui empêchait de vendre plus de 24 unités d'un item à
|
||||||
|
la fois.
|
||||||
|
- L'interface indique plus clairement quand on fait une erreur en modifiant un
|
||||||
|
compte.
|
||||||
|
- On supprime la fonction "décalage de balance".
|
||||||
|
- L'accès à l'historique est maintenant limité à 7 jours pour raison de
|
||||||
|
confidentialité. Les chefs/trez peuvent disposer d'une permission
|
||||||
|
supplémentaire pour accéder à jusqu'à 30 jours en cas de problème de compta.
|
||||||
|
L'accès à son historique personnel n'est pas limité. Les durées sont
|
||||||
|
configurables dans `settings/cof_prod.py`.
|
||||||
|
|
||||||
|
### COF
|
||||||
|
|
||||||
|
- Le Captcha sur la page de demande de petits cours utilise maintenant hCaptcha
|
||||||
|
au lieu de ReCaptcha, pour mieux respecter la vie privée des utilisateur·ices
|
||||||
|
|
||||||
|
## Version 0.9 - 06/02/2020
|
||||||
|
|
||||||
### COF / BdA
|
### COF / BdA
|
||||||
|
|
||||||
|
- Le COF peut remettre à zéro la liste de ses adhérents en août (sans passer par
|
||||||
|
KDE).
|
||||||
|
- La page d'accueil affiche la date de fermeture des tirages BdA.
|
||||||
- On peut revendre une place dès qu'on l'a payée, plus besoin de payer toutes
|
- On peut revendre une place dès qu'on l'a payée, plus besoin de payer toutes
|
||||||
ses places pour pouvoir revendre.
|
ses places pour pouvoir revendre.
|
||||||
- On s'assure que les emails dans les demandes de petits cours sont valides.
|
- On s'assure que l'email fourni lors d'une demande de petit cours est valide.
|
||||||
|
|
||||||
|
### BDS
|
||||||
|
|
||||||
|
- Le burô peut maintenant accorder ou révoquer le statut de membre du Burô
|
||||||
|
en modifiant le profil d'un membre du BDS.
|
||||||
|
- Le burô peut exporter la liste de ses membres avec email au format CSV depuis
|
||||||
|
la page d'accueil.
|
||||||
|
|
||||||
### K-Fêt
|
### K-Fêt
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# GestioCOF
|
# GestioCOF / GestioBDS
|
||||||
|
|
||||||
[![pipeline status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/pipeline.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master)
|
[![pipeline status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/pipeline.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master)
|
||||||
[![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master)
|
[![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master)
|
||||||
|
@ -38,11 +38,11 @@ Vous pouvez maintenant installer les dépendances Python depuis le fichier
|
||||||
pip install -U pip # parfois nécessaire la première fois
|
pip install -U pip # parfois nécessaire la première fois
|
||||||
pip install -r requirements-devel.txt
|
pip install -r requirements-devel.txt
|
||||||
|
|
||||||
Pour terminer, copier le fichier `cof/settings/secret_example.py` vers
|
Pour terminer, copier le fichier `gestioasso/settings/secret_example.py` vers
|
||||||
`cof/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien symbolique
|
`gestioasso/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien symbolique
|
||||||
pour profiter de façon transparente des mises à jour du fichier:
|
pour profiter de façon transparente des mises à jour du fichier:
|
||||||
|
|
||||||
ln -s secret_example.py cof/settings/secret.py
|
ln -s secret_example.py gestioasso/settings/secret.py
|
||||||
|
|
||||||
Nous avons un git hook de pre-commit pour formatter et vérifier que votre code
|
Nous avons un git hook de pre-commit pour formatter et vérifier que votre code
|
||||||
vérifie nos conventions. Pour bénéficier des mises à jour du hook, préférez
|
vérifie nos conventions. Pour bénéficier des mises à jour du hook, préférez
|
||||||
|
|
17
bda/admin.py
17
bda/admin.py
|
@ -33,20 +33,6 @@ class ReadOnlyMixin(object):
|
||||||
return readonly_fields + self.readonly_fields_update
|
return readonly_fields + self.readonly_fields_update
|
||||||
|
|
||||||
|
|
||||||
class ChoixSpectacleAdminForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
widgets = {
|
|
||||||
"participant": ModelSelect2(url="bda-participant-autocomplete"),
|
|
||||||
"spectacle": ModelSelect2(url="bda-spectacle-autocomplete"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ChoixSpectacleInline(admin.TabularInline):
|
|
||||||
model = ChoixSpectacle
|
|
||||||
form = ChoixSpectacleAdminForm
|
|
||||||
sortable_field_name = "priority"
|
|
||||||
|
|
||||||
|
|
||||||
class AttributionTabularAdminForm(forms.ModelForm):
|
class AttributionTabularAdminForm(forms.ModelForm):
|
||||||
listing = None
|
listing = None
|
||||||
|
|
||||||
|
@ -225,7 +211,6 @@ class AttributionAdminForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin):
|
class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ("id", "spectacle", "participant", "given", "paid")
|
list_display = ("id", "spectacle", "participant", "given", "paid")
|
||||||
search_fields = (
|
search_fields = (
|
||||||
"spectacle__title",
|
"spectacle__title",
|
||||||
|
@ -238,7 +223,7 @@ class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
||||||
form = ChoixSpectacleAdminForm
|
autocomplete_fields = ["participant", "spectacle"]
|
||||||
|
|
||||||
def tirage(self, obj):
|
def tirage(self, obj):
|
||||||
return obj.participant.tirage
|
return obj.participant.tirage
|
||||||
|
|
|
@ -2,7 +2,6 @@ import random
|
||||||
|
|
||||||
|
|
||||||
class Algorithm(object):
|
class Algorithm(object):
|
||||||
|
|
||||||
shows = None
|
shows = None
|
||||||
ranks = None
|
ranks = None
|
||||||
origranks = None
|
origranks = None
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Command(MyBaseCommand):
|
||||||
shows = random.sample(
|
shows = random.sample(
|
||||||
list(tirage.spectacle_set.all()), tirage.spectacle_set.count() // 2
|
list(tirage.spectacle_set.all()), tirage.spectacle_set.count() // 2
|
||||||
)
|
)
|
||||||
for (rank, show) in enumerate(shows):
|
for rank, show in enumerate(shows):
|
||||||
choices.append(
|
choices.append(
|
||||||
ChoixSpectacle(
|
ChoixSpectacle(
|
||||||
participant=part,
|
participant=part,
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -35,7 +35,6 @@ def fill_tirage_fields(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0001_initial")]
|
dependencies = [("bda", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0002_add_tirage")]
|
dependencies = [("bda", "0002_add_tirage")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0003_update_tirage_and_spectacle")]
|
dependencies = [("bda", "0003_update_tirage_and_spectacle")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0004_mails-rappel")]
|
dependencies = [("bda", "0004_mails-rappel")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -18,7 +18,6 @@ def forwards_func(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0005_encoding")]
|
dependencies = [("bda", "0005_encoding")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0006_add_tirage_switch")]
|
dependencies = [("bda", "0006_add_tirage_switch")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0007_extends_spectacle")]
|
dependencies = [("bda", "0007_extends_spectacle")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0008_py3")]
|
dependencies = [("bda", "0008_py3")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -21,7 +21,6 @@ def forwards_func(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0009_revente")]
|
dependencies = [("bda", "0009_revente")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0010_spectaclerevente_shotgun")]
|
dependencies = [("bda", "0010_spectaclerevente_shotgun")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -13,7 +13,6 @@ def swap_double_choice(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0012_notif_time"), ("bda", "0012_swap_double_choice")]
|
dependencies = [("bda", "0012_notif_time"), ("bda", "0012_swap_double_choice")]
|
||||||
|
|
||||||
operations = []
|
operations = []
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0013_merge_20180524_2123")]
|
dependencies = [("bda", "0013_merge_20180524_2123")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -29,7 +29,6 @@ def set_participant_payment(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0014_attribution_paid_field")]
|
dependencies = [("bda", "0014_attribution_paid_field")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0015_move_bda_payment")]
|
dependencies = [("bda", "0015_move_bda_payment")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bda", "0016_delete_participant_paid")]
|
dependencies = [("bda", "0016_delete_participant_paid")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bda", "0017_participant_accepte_charte"),
|
("bda", "0017_participant_accepte_charte"),
|
||||||
]
|
]
|
||||||
|
|
23
bda/migrations/0019_auto_20220630_1245.py
Normal file
23
bda/migrations/0019_auto_20220630_1245.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.2.13 on 2022-06-30 10:45
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("bda", "0018_auto_20201021_1818"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="choixspectacle",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="choixspectacle",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("participant", "spectacle"), name="unique_participation"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -253,7 +253,11 @@ class ChoixSpectacle(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ("priority",)
|
ordering = ("priority",)
|
||||||
unique_together = (("participant", "spectacle"),)
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["participant", "spectacle"], name="unique_participation"
|
||||||
|
)
|
||||||
|
]
|
||||||
verbose_name = "voeu"
|
verbose_name = "voeu"
|
||||||
verbose_name_plural = "voeux"
|
verbose_name_plural = "voeux"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>État des inscriptions BdA</h2>
|
<h2>État des inscriptions BdA</h2>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<script type="text/javascript" src="{% static 'vendor/jquery/jquery-ui.min.js' %}" ></script>
|
<script type="text/javascript" src="{% static 'vendor/jquery/jquery-ui.min.js' %}" ></script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>{{ spectacle }}</h2>
|
<h2>{{ spectacle }}</h2>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
|
|
||||||
{%block realcontent %}
|
{%block realcontent %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>Inscription à une revente</h2>
|
<h2>Inscription à une revente</h2>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles%}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>Inscriptions pour BdA-Revente</h2>
|
<h2>Inscriptions pour BdA-Revente</h2>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
||||||
|
|
|
@ -356,7 +356,9 @@ class TestReventeManageTest(TestCase):
|
||||||
|
|
||||||
def test_can_get(self):
|
def test_can_get(self):
|
||||||
client = Client()
|
client = Client()
|
||||||
client.force_login(self.user)
|
client.force_login(
|
||||||
|
self.user, backend="django.contrib.auth.backends.ModelBackend"
|
||||||
|
)
|
||||||
r = client.get(self.url)
|
r = client.get(self.url)
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
|
||||||
|
|
42
bda/urls.py
42
bda/urls.py
|
@ -1,74 +1,80 @@
|
||||||
from django.conf.urls import url
|
from django.urls import re_path
|
||||||
|
|
||||||
from bda import views
|
from bda import views
|
||||||
from bda.views import SpectacleListView
|
from bda.views import SpectacleListView
|
||||||
from gestioncof.decorators import buro_required
|
from gestioncof.decorators import buro_required
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(
|
re_path(
|
||||||
r"^inscription/(?P<tirage_id>\d+)$",
|
r"^inscription/(?P<tirage_id>\d+)$",
|
||||||
views.inscription,
|
views.inscription,
|
||||||
name="bda-tirage-inscription",
|
name="bda-tirage-inscription",
|
||||||
),
|
),
|
||||||
url(r"^places/(?P<tirage_id>\d+)$", views.places, name="bda-places-attribuees"),
|
re_path(r"^places/(?P<tirage_id>\d+)$", views.places, name="bda-places-attribuees"),
|
||||||
url(r"^etat-places/(?P<tirage_id>\d+)$", views.etat_places, name="bda-etat-places"),
|
re_path(
|
||||||
url(r"^tirage/(?P<tirage_id>\d+)$", views.tirage, name="bda-tirage"),
|
r"^etat-places/(?P<tirage_id>\d+)$", views.etat_places, name="bda-etat-places"
|
||||||
url(
|
),
|
||||||
|
re_path(r"^tirage/(?P<tirage_id>\d+)$", views.tirage, name="bda-tirage"),
|
||||||
|
re_path(
|
||||||
r"^spectacles/(?P<tirage_id>\d+)$",
|
r"^spectacles/(?P<tirage_id>\d+)$",
|
||||||
buro_required(SpectacleListView.as_view()),
|
buro_required(SpectacleListView.as_view()),
|
||||||
name="bda-liste-spectacles",
|
name="bda-liste-spectacles",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^spectacles/(?P<tirage_id>\d+)/(?P<spectacle_id>\d+)$",
|
r"^spectacles/(?P<tirage_id>\d+)/(?P<spectacle_id>\d+)$",
|
||||||
views.spectacle,
|
views.spectacle,
|
||||||
name="bda-spectacle",
|
name="bda-spectacle",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^spectacles/unpaid/(?P<tirage_id>\d+)$",
|
r"^spectacles/unpaid/(?P<tirage_id>\d+)$",
|
||||||
views.UnpaidParticipants.as_view(),
|
views.UnpaidParticipants.as_view(),
|
||||||
name="bda-unpaid",
|
name="bda-unpaid",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^spectacles/autocomplete$",
|
r"^spectacles/autocomplete$",
|
||||||
views.spectacle_autocomplete,
|
views.spectacle_autocomplete,
|
||||||
name="bda-spectacle-autocomplete",
|
name="bda-spectacle-autocomplete",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^participants/autocomplete$",
|
r"^participants/autocomplete$",
|
||||||
views.participant_autocomplete,
|
views.participant_autocomplete,
|
||||||
name="bda-participant-autocomplete",
|
name="bda-participant-autocomplete",
|
||||||
),
|
),
|
||||||
# Urls BdA-Revente
|
# Urls BdA-Revente
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<tirage_id>\d+)/manage$",
|
r"^revente/(?P<tirage_id>\d+)/manage$",
|
||||||
views.revente_manage,
|
views.revente_manage,
|
||||||
name="bda-revente-manage",
|
name="bda-revente-manage",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<tirage_id>\d+)/subscribe$",
|
r"^revente/(?P<tirage_id>\d+)/subscribe$",
|
||||||
views.revente_subscribe,
|
views.revente_subscribe,
|
||||||
name="bda-revente-subscribe",
|
name="bda-revente-subscribe",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<tirage_id>\d+)/tirages$",
|
r"^revente/(?P<tirage_id>\d+)/tirages$",
|
||||||
views.revente_tirages,
|
views.revente_tirages,
|
||||||
name="bda-revente-tirages",
|
name="bda-revente-tirages",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<spectacle_id>\d+)/buy$",
|
r"^revente/(?P<spectacle_id>\d+)/buy$",
|
||||||
views.revente_buy,
|
views.revente_buy,
|
||||||
name="bda-revente-buy",
|
name="bda-revente-buy",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<revente_id>\d+)/confirm$",
|
r"^revente/(?P<revente_id>\d+)/confirm$",
|
||||||
views.revente_confirm,
|
views.revente_confirm,
|
||||||
name="bda-revente-confirm",
|
name="bda-revente-confirm",
|
||||||
),
|
),
|
||||||
url(
|
re_path(
|
||||||
r"^revente/(?P<tirage_id>\d+)/shotgun$",
|
r"^revente/(?P<tirage_id>\d+)/shotgun$",
|
||||||
views.revente_shotgun,
|
views.revente_shotgun,
|
||||||
name="bda-revente-shotgun",
|
name="bda-revente-shotgun",
|
||||||
),
|
),
|
||||||
url(r"^mails-rappel/(?P<spectacle_id>\d+)$", views.send_rappel, name="bda-rappels"),
|
re_path(
|
||||||
url(r"^catalogue/(?P<request_type>[a-z]+)$", views.catalogue, name="bda-catalogue"),
|
r"^mails-rappel/(?P<spectacle_id>\d+)$", views.send_rappel, name="bda-rappels"
|
||||||
|
),
|
||||||
|
re_path(
|
||||||
|
r"^catalogue/(?P<request_type>[a-z]+)$", views.catalogue, name="bda-catalogue"
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -274,13 +274,13 @@ def do_tirage(tirage_elt, token):
|
||||||
results = Algorithm(data["shows"], data["members"], choices)(token)
|
results = Algorithm(data["shows"], data["members"], choices)(token)
|
||||||
|
|
||||||
# On compte les places attribuées et les déçus
|
# On compte les places attribuées et les déçus
|
||||||
for (_, members, losers) in results:
|
for _, members, losers in results:
|
||||||
data["total_slots"] += len(members)
|
data["total_slots"] += len(members)
|
||||||
data["total_losers"] += len(losers)
|
data["total_losers"] += len(losers)
|
||||||
|
|
||||||
# On calcule le déficit et les bénéfices pour le BdA
|
# On calcule le déficit et les bénéfices pour le BdA
|
||||||
# FIXME: le traitement de l'opéra est sale
|
# FIXME: le traitement de l'opéra est sale
|
||||||
for (show, members, _) in results:
|
for show, members, _ in results:
|
||||||
deficit = (show.slots - len(members)) * show.price
|
deficit = (show.slots - len(members)) * show.price
|
||||||
data["total_sold"] += show.slots * show.price
|
data["total_sold"] += show.slots * show.price
|
||||||
if deficit >= 0:
|
if deficit >= 0:
|
||||||
|
@ -293,8 +293,8 @@ def do_tirage(tirage_elt, token):
|
||||||
# so assign a single object for each Participant id
|
# so assign a single object for each Participant id
|
||||||
members_uniq = {}
|
members_uniq = {}
|
||||||
members2 = {}
|
members2 = {}
|
||||||
for (show, members, _) in results:
|
for show, members, _ in results:
|
||||||
for (member, _, _, _) in members:
|
for member, _, _, _ in members:
|
||||||
if member.id not in members_uniq:
|
if member.id not in members_uniq:
|
||||||
members_uniq[member.id] = member
|
members_uniq[member.id] = member
|
||||||
members2[member] = []
|
members2[member] = []
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
default_app_config = "bds.apps.BdsConfig"
|
|
|
@ -1,5 +1,4 @@
|
||||||
from django import apps as global_apps
|
from django.apps import AppConfig, apps as global_apps
|
||||||
from django.apps import AppConfig
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.db.models.signals import post_migrate
|
from django.db.models.signals import post_migrate
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from bds.models import BDSProfile
|
from bds.models import BDSProfile
|
||||||
|
|
||||||
|
@ -8,6 +9,8 @@ User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class UserForm(forms.ModelForm):
|
class UserForm(forms.ModelForm):
|
||||||
|
is_buro = forms.BooleanField(label=_("Membre du Burô"), required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ["email", "first_name", "last_name"]
|
fields = ["email", "first_name", "last_name"]
|
||||||
|
@ -33,4 +36,6 @@ class ProfileForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = BDSProfile
|
model = BDSProfile
|
||||||
exclude = ["user"]
|
exclude = ["user"]
|
||||||
widgets = {"birthdate": forms.DateInput(attrs={"type": "date"})}
|
widgets = {
|
||||||
|
"birthdate": forms.DateInput(attrs={"type": "date"}, format="%Y-%m-%d")
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import bds.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||||
|
|
|
@ -9,7 +9,6 @@ def create_bds_buro_group(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("bds", "0001_initial")]
|
dependencies = [("bds", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bds", "0002_bds_group"),
|
("bds", "0002_bds_group"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bds", "0003_staff_permission"),
|
("bds", "0003_staff_permission"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bds", "0004_is_member_cotiz_type"),
|
("bds", "0004_is_member_cotiz_type"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bds", "0005_remove_bdsprofile_certificate_file"),
|
("bds", "0005_remove_bdsprofile_certificate_file"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,6 +3,7 @@ from os.path import splitext
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from shared.utils import choices_length
|
from shared.utils import choices_length
|
||||||
|
@ -93,6 +94,16 @@ class BDSProfile(models.Model):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def expired_members(cls):
|
||||||
|
now = timezone.now()
|
||||||
|
qs = cls.objects.filter(is_member=True)
|
||||||
|
if now.month > 1 and now.month < 7:
|
||||||
|
return qs.filter(cotisation_period="SE1")
|
||||||
|
elif now.month < 2 or now.month > 8:
|
||||||
|
return qs.none()
|
||||||
|
return qs
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Profil BDS")
|
verbose_name = _("Profil BDS")
|
||||||
verbose_name_plural = _("Profils BDS")
|
verbose_name_plural = _("Profils BDS")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
{% load bulma_utils %}
|
{% load bulma_utils %}
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
22
bds/templates/bds/expired_members.html
Normal file
22
bds/templates/bds/expired_members.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends "bds/base.html" %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1 class="title">Liste des adhésions expirées</h1>
|
||||||
|
|
||||||
|
{% if object_list %}
|
||||||
|
<div class="content">
|
||||||
|
<ul>
|
||||||
|
{% for p in object_list %}
|
||||||
|
<li>{{ p.user.first_name }} {{ p.user.last_name }} ({{ p.user.username }}), {{ p.get_cotisation_period_display }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="buttons is-centered">
|
||||||
|
<a class="button is-danger" href="{% url 'bds:members.reset' %}">Réinitialiser les adhésions expirées</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -34,6 +34,13 @@
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<a class=button href="{% url 'bds:export.members' %}">Télécharger la liste des membres (CSV)</a>
|
||||||
|
|
||||||
|
<a class=button href="{% url 'bds:members.expired' %}">Liste des adhésions expirées ({{ nb_expired }})</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
Le site est encore en développement.
|
Le site est encore en développement.
|
||||||
<br>
|
<br>
|
||||||
Suivez notre avancement sur
|
Suivez notre avancement sur
|
||||||
|
|
|
@ -5,100 +5,100 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% for form in forms.values %}
|
{% for form in forms.values %}
|
||||||
{% for error in form.non_field_errors %}
|
{% for error in form.non_field_errors %}
|
||||||
<div class="notification is-danger">
|
<div class="notification is-danger">
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<h1 class="title">{% trans "Modification du profil " %}{{ view.user.username }}</h1>
|
<h1 class="title">{% trans "Modification du profil " %}{{ view.user.username }}</h1>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form method="post" action="" id="user-update-form">
|
<form method="post" action="" id="user-update-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{% for form in forms.values %}
|
{% for form in forms.values %}
|
||||||
{% include "bds/forms/form.html" with form=form errors=False %}
|
{% include "bds/forms/form.html" with form=form errors=False %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form method="post" action="{% url 'bds:user.delete' view.user.pk %}" id="user-delete-form">
|
<form method="post" action="{% url 'bds:user.delete' view.user.pk %}" id="user-delete-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="columns is-gapless mt-5">
|
<div class="columns is-gapless mt-5">
|
||||||
<div class="column is-5">
|
<div class="column is-5">
|
||||||
<button id="user-update-button" class="button is-fullwidth is-primary">Enregistrer</button>
|
<button id="user-update-button" class="button is-fullwidth is-primary">Enregistrer</button>
|
||||||
|
</div>
|
||||||
|
<div class="column is-2">
|
||||||
|
</div>
|
||||||
|
<div class="column is-5">
|
||||||
|
<button id="user-delete-button" class="button is-fullwidth is-danger">Supprimer</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-2">
|
|
||||||
</div>
|
|
||||||
<div class="column is-5">
|
|
||||||
<button id="user-delete-button" class="button is-fullwidth is-danger">Supprimer</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Hidden by default -->
|
<!-- Hidden by default -->
|
||||||
<div id="confirm-delete-modal" class="modal">
|
<div id="confirm-delete-modal" class="modal">
|
||||||
<div class="modal-background"></div>
|
<div class="modal-background"></div>
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
<header class="modal-card-head">
|
<header class="modal-card-head">
|
||||||
<p class="modal-card-title">Confirmer la suppression</p>
|
<p class="modal-card-title">Confirmer la suppression</p>
|
||||||
<button id= "modal-close" class="delete" aria-label="close"></button>
|
<button id="modal-close" class="delete" aria-label="close"></button>
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
Voulez-vous réellement supprimer ce compte ? Attention, cette opération est irréversible !
|
Voulez-vous réellement supprimer ce compte ? Attention, cette opération est irréversible !
|
||||||
</section>
|
</section>
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<button id="confirm-delete-button" class="button is-primary">Supprimer</button>
|
<button id="confirm-delete-button" class="button is-primary">Supprimer</button>
|
||||||
<button id="cancel-delete-button" class="button">Annuler</button>
|
<button id="cancel-delete-button" class="button">Annuler</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Adapted from https://bulma.io/lib/main.js
|
// Adapted from https://bulma.io/lib/main.js
|
||||||
function openModal(target) {
|
function openModal(target) {
|
||||||
$(document).addClass('is-clipped');
|
$(document).addClass('is-clipped');
|
||||||
$(`#${target}`).addClass('is-active');
|
$(`#${target}`).addClass('is-active');
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeModals() {
|
function closeModals() {
|
||||||
$(document).removeClass('is-clipped');
|
$(document).removeClass('is-clipped');
|
||||||
$(".modal").removeClass('is-active');
|
$(".modal").removeClass('is-active');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si on clique sur enregistrer, ça marche
|
// Si on clique sur enregistrer, ça marche
|
||||||
$("#user-update-button").on("click", function() {
|
$("#user-update-button").on("click", function() {
|
||||||
$("#user-update-form").submit();
|
$("#user-update-form").submit();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Si on clique sur supprimer, confirmation demandée
|
||||||
|
$("#user-delete-button").on("click", function() {
|
||||||
|
openModal("confirm-delete-modal");
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".modal-background, #modal-close, #cancel-delete-button").on("click", closeModals);
|
||||||
|
|
||||||
|
$("#confirm-delete-button").on("click", function() {
|
||||||
|
$("#user-delete-form").submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("keydown", function(e) {
|
||||||
|
if (e.key == "Escape") {
|
||||||
|
closeModals();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key == "Enter") {
|
||||||
|
$("#user-update-form").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Si on clique sur supprimer, confirmation demandée
|
|
||||||
$("#user-delete-button").on("click", function () {
|
|
||||||
openModal("confirm-delete-modal");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".modal-background, #modal-close, #cancel-delete-button").on("click", closeModals);
|
|
||||||
|
|
||||||
$("#confirm-delete-button").on("click", function() {
|
|
||||||
$("#user-delete-form").submit();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on("keydown", function (e) {
|
|
||||||
if (e.key == "Escape") {
|
|
||||||
closeModals();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key == "Enter") {
|
|
||||||
$("#user-update-form").submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -22,6 +22,18 @@ def login_url(next=None):
|
||||||
return "{}?next={}".format(login_url, next)
|
return "{}?next={}".format(login_url, next)
|
||||||
|
|
||||||
|
|
||||||
|
class TestHomeView(TestCase):
|
||||||
|
@mock.patch("gestioncof.signals.messages")
|
||||||
|
def test_get(self, mock_messages):
|
||||||
|
user = User.objects.create_user(username="random_user")
|
||||||
|
give_bds_buro_permissions(user)
|
||||||
|
self.client.force_login(
|
||||||
|
user, backend="django.contrib.auth.backends.ModelBackend"
|
||||||
|
)
|
||||||
|
resp = self.client.get(reverse("bds:home"))
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
class TestRegistrationView(TestCase):
|
class TestRegistrationView(TestCase):
|
||||||
@mock.patch("gestioncof.signals.messages")
|
@mock.patch("gestioncof.signals.messages")
|
||||||
def test_get_autocomplete(self, mock_messages):
|
def test_get_autocomplete(self, mock_messages):
|
||||||
|
@ -34,14 +46,14 @@ class TestRegistrationView(TestCase):
|
||||||
self.assertRedirects(resp, login_url(next=url))
|
self.assertRedirects(resp, login_url(next=url))
|
||||||
|
|
||||||
# Logged-in but unprivileged GET
|
# Logged-in but unprivileged GET
|
||||||
client.force_login(user)
|
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||||
resp = client.get(url)
|
resp = client.get(url)
|
||||||
self.assertEquals(resp.status_code, 403)
|
self.assertEqual(resp.status_code, 403)
|
||||||
|
|
||||||
# Burô user GET
|
# Burô user GET
|
||||||
give_bds_buro_permissions(user)
|
give_bds_buro_permissions(user)
|
||||||
resp = client.get(url)
|
resp = client.get(url)
|
||||||
self.assertEquals(resp.status_code, 200)
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
@mock.patch("gestioncof.signals.messages")
|
@mock.patch("gestioncof.signals.messages")
|
||||||
def test_get(self, mock_messages):
|
def test_get(self, mock_messages):
|
||||||
|
@ -54,11 +66,11 @@ class TestRegistrationView(TestCase):
|
||||||
self.assertRedirects(resp, login_url(next=url))
|
self.assertRedirects(resp, login_url(next=url))
|
||||||
|
|
||||||
# Logged-in but unprivileged GET
|
# Logged-in but unprivileged GET
|
||||||
client.force_login(user)
|
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||||
resp = client.get(url)
|
resp = client.get(url)
|
||||||
self.assertEquals(resp.status_code, 403)
|
self.assertEqual(resp.status_code, 403)
|
||||||
|
|
||||||
# Burô user GET
|
# Burô user GET
|
||||||
give_bds_buro_permissions(user)
|
give_bds_buro_permissions(user)
|
||||||
resp = client.get(url)
|
resp = client.get(url)
|
||||||
self.assertEquals(resp.status_code, 200)
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
|
@ -14,4 +14,11 @@ urlpatterns = [
|
||||||
name="user.create.fromclipper",
|
name="user.create.fromclipper",
|
||||||
),
|
),
|
||||||
path("user/delete/<int:pk>", views.UserDeleteView.as_view(), name="user.delete"),
|
path("user/delete/<int:pk>", views.UserDeleteView.as_view(), name="user.delete"),
|
||||||
|
path("members", views.export_members, name="export.members"),
|
||||||
|
path(
|
||||||
|
"members/expired",
|
||||||
|
views.ResetMembershipListView.as_view(),
|
||||||
|
name="members.expired",
|
||||||
|
),
|
||||||
|
path("members/reset", views.ResetMembershipView.as_view(), name="members.reset"),
|
||||||
]
|
]
|
||||||
|
|
56
bds/views.py
56
bds/views.py
|
@ -1,9 +1,14 @@
|
||||||
|
import csv
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.contrib.auth.decorators import permission_required
|
||||||
|
from django.contrib.auth.models import Permission
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import DeleteView, TemplateView
|
from django.views.generic import DeleteView, ListView, RedirectView, TemplateView
|
||||||
|
|
||||||
from bds.autocomplete import bds_search
|
from bds.autocomplete import bds_search
|
||||||
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
|
from bds.forms import ProfileForm, UserForm, UserFromClipperForm, UserFromScratchForm
|
||||||
|
@ -25,6 +30,7 @@ class Home(StaffRequiredMixin, TemplateView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["member_count"] = BDSProfile.objects.filter(is_member=True).count()
|
context["member_count"] = BDSProfile.objects.filter(is_member=True).count()
|
||||||
|
context["nb_expired"] = BDSProfile.expired_members().count()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +42,9 @@ class UserUpdateView(StaffRequiredMixin, MultipleFormView):
|
||||||
"profile": ProfileForm,
|
"profile": ProfileForm,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_user_initial(self):
|
||||||
|
return {"is_buro": self.get_user_instance().has_perm("bds.is_team")}
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
self.user = get_object_or_404(User, pk=self.kwargs["pk"])
|
self.user = get_object_or_404(User, pk=self.kwargs["pk"])
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
@ -52,6 +61,11 @@ class UserUpdateView(StaffRequiredMixin, MultipleFormView):
|
||||||
def form_valid(self, forms):
|
def form_valid(self, forms):
|
||||||
user = forms["user"].save()
|
user = forms["user"].save()
|
||||||
profile = forms["profile"].save(commit=False)
|
profile = forms["profile"].save(commit=False)
|
||||||
|
perm = Permission.objects.get(content_type__app_label="bds", codename="is_team")
|
||||||
|
if forms["user"].cleaned_data["is_buro"]:
|
||||||
|
user.user_permissions.add(perm)
|
||||||
|
else:
|
||||||
|
user.user_permissions.remove(perm)
|
||||||
profile.user = user
|
profile.user = user
|
||||||
profile.save()
|
profile.save()
|
||||||
messages.success(self.request, _("Profil mis à jour avec succès !"))
|
messages.success(self.request, _("Profil mis à jour avec succès !"))
|
||||||
|
@ -128,3 +142,43 @@ class UserDeleteView(StaffRequiredMixin, DeleteView):
|
||||||
messages.success(request, self.success_message)
|
messages.success(request, self.success_message)
|
||||||
|
|
||||||
return super().delete(request, *args, **kwargs)
|
return super().delete(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class ResetMembershipListView(StaffRequiredMixin, ListView):
|
||||||
|
model = BDSProfile
|
||||||
|
template_name = "bds/expired_members.html"
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return BDSProfile.expired_members()
|
||||||
|
|
||||||
|
|
||||||
|
class ResetMembershipView(StaffRequiredMixin, RedirectView):
|
||||||
|
url = reverse_lazy("bds:members.expired")
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
qs = BDSProfile.expired_members()
|
||||||
|
nb = qs.count()
|
||||||
|
|
||||||
|
qs.update(cotisation_period="NO", is_member=False, mails_bds=False)
|
||||||
|
|
||||||
|
messages.success(request, f"{nb} adhésions réinitialisées")
|
||||||
|
|
||||||
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@permission_required("bds.is_team")
|
||||||
|
def export_members(request):
|
||||||
|
response = HttpResponse(content_type="text/csv")
|
||||||
|
response["Content-Disposition"] = "attachment; filename=membres_bds.csv"
|
||||||
|
|
||||||
|
writer = csv.writer(response)
|
||||||
|
for profile in BDSProfile.objects.filter(is_member=True).all():
|
||||||
|
user = profile.user
|
||||||
|
bits = [
|
||||||
|
user.username,
|
||||||
|
user.get_full_name(),
|
||||||
|
user.email,
|
||||||
|
]
|
||||||
|
writer.writerow([str(bit) for bit in bits])
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import os
|
|
||||||
|
|
||||||
from channels.asgi import get_channel_layer
|
|
||||||
|
|
||||||
if "DJANGO_SETTINGS_MODULE" not in os.environ:
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cof.settings")
|
|
||||||
|
|
||||||
channel_layer = get_channel_layer()
|
|
|
@ -1,3 +0,0 @@
|
||||||
from channels.routing import include
|
|
||||||
|
|
||||||
routing = [include("kfet.routing.routing", path=r"^/ws/k-fet")]
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
("events", "0001_event"),
|
("events", "0001_event"),
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
("events", "0002_event_subscribers"),
|
("events", "0002_event_subscribers"),
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
("events", "0003_options_and_extra_fields"),
|
("events", "0003_options_and_extra_fields"),
|
||||||
|
|
63
events/migrations/0005_auto_20220630_1239.py
Normal file
63
events/migrations/0005_auto_20220630_1239.py
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
# Generated by Django 3.2.13 on 2022-06-30 10:39
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("events", "0004_unique_constraints"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="extrafield",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="extrafieldcontent",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="option",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="optionchoice",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="registration",
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="extrafield",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("event", "name"), name="unique_extra_field"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="extrafieldcontent",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("field", "registration"), name="unique_extra_field_content"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="option",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("event", "name"), name="unique_event_option"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="optionchoice",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("option", "choice"), name="unique_option_choice"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name="registration",
|
||||||
|
constraint=models.UniqueConstraint(
|
||||||
|
fields=("event", "user"), name="unique_registration"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -72,9 +72,13 @@ class Option(models.Model):
|
||||||
multi_choices = models.BooleanField(_("choix multiples"), default=False)
|
multi_choices = models.BooleanField(_("choix multiples"), default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["event", "name"], name="unique_event_option"
|
||||||
|
)
|
||||||
|
]
|
||||||
verbose_name = _("option d'événement")
|
verbose_name = _("option d'événement")
|
||||||
verbose_name_plural = _("options d'événement")
|
verbose_name_plural = _("options d'événement")
|
||||||
unique_together = [["event", "name"]]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -87,9 +91,13 @@ class OptionChoice(models.Model):
|
||||||
choice = models.CharField(_("choix"), max_length=200)
|
choice = models.CharField(_("choix"), max_length=200)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["option", "choice"], name="unique_option_choice"
|
||||||
|
)
|
||||||
|
]
|
||||||
verbose_name = _("choix d'option d'événement")
|
verbose_name = _("choix d'option d'événement")
|
||||||
verbose_name_plural = _("choix d'option d'événement")
|
verbose_name_plural = _("choix d'option d'événement")
|
||||||
unique_together = [["option", "choice"]]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.choice
|
return self.choice
|
||||||
|
@ -118,7 +126,9 @@ class ExtraField(models.Model):
|
||||||
field_type = models.CharField(_("type de champ"), max_length=9, choices=FIELD_TYPE)
|
field_type = models.CharField(_("type de champ"), max_length=9, choices=FIELD_TYPE)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [["event", "name"]]
|
constraints = [
|
||||||
|
models.UniqueConstraint(fields=["event", "name"], name="unique_extra_field")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class ExtraFieldContent(models.Model):
|
class ExtraFieldContent(models.Model):
|
||||||
|
@ -137,9 +147,13 @@ class ExtraFieldContent(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["field", "registration"], name="unique_extra_field_content"
|
||||||
|
)
|
||||||
|
]
|
||||||
verbose_name = _("contenu d'un champ événement supplémentaire")
|
verbose_name = _("contenu d'un champ événement supplémentaire")
|
||||||
verbose_name_plural = _("contenus d'un champ événement supplémentaire")
|
verbose_name_plural = _("contenus d'un champ événement supplémentaire")
|
||||||
unique_together = [["field", "registration"]]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
max_length = 50
|
max_length = 50
|
||||||
|
@ -163,9 +177,13 @@ class Registration(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["event", "user"], name="unique_registration"
|
||||||
|
)
|
||||||
|
]
|
||||||
verbose_name = _("inscription à un événement")
|
verbose_name = _("inscription à un événement")
|
||||||
verbose_name_plural = _("inscriptions à un événement")
|
verbose_name_plural = _("inscriptions à un événement")
|
||||||
unique_together = [["event", "user"]]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "inscription de {} à {}".format(self.user, self.event)
|
return "inscription de {} à {}".format(self.user, self.event)
|
||||||
|
|
|
@ -54,7 +54,9 @@ class CSVExportAccessTest(MessagePatch, TestCase):
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
client = Client()
|
client = Client()
|
||||||
client.force_login(self.staff)
|
client.force_login(
|
||||||
|
self.staff, backend="django.contrib.auth.backends.ModelBackend"
|
||||||
|
)
|
||||||
r = client.get(self.url)
|
r = client.get(self.url)
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ class CSVExportAccessTest(MessagePatch, TestCase):
|
||||||
|
|
||||||
def test_unauthorised(self):
|
def test_unauthorised(self):
|
||||||
client = Client()
|
client = Client()
|
||||||
client.force_login(self.u1)
|
client.force_login(self.u1, backend="django.contrib.auth.backends.ModelBackend")
|
||||||
r = client.get(self.url)
|
r = client.get(self.url)
|
||||||
self.assertEqual(r.status_code, 403)
|
self.assertEqual(r.status_code, 403)
|
||||||
|
|
||||||
|
@ -86,7 +88,9 @@ class CSVExportContentTest(MessagePatch, CSVResponseMixin, TestCase):
|
||||||
)
|
)
|
||||||
self.staff = make_staff_user("staff")
|
self.staff = make_staff_user("staff")
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
self.client.force_login(self.staff)
|
self.client.force_login(
|
||||||
|
self.staff, backend="django.contrib.auth.backends.ModelBackend"
|
||||||
|
)
|
||||||
|
|
||||||
def test_simple_event(self):
|
def test_simple_event(self):
|
||||||
self.event.subscribers.set([self.u1, self.u2])
|
self.event.subscribers.set([self.u1, self.u2])
|
||||||
|
|
15
gestioasso/asgi.py
Normal file
15
gestioasso/asgi.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
"""
|
||||||
|
ASGI entrypoint. Configures Django and then runs the application
|
||||||
|
defined in the ASGI_APPLICATION setting.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import django
|
||||||
|
from channels.routing import get_default_application
|
||||||
|
|
||||||
|
if "DJANGO_SETTINGS_MODULE" not in os.environ:
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gestioasso.settings.local")
|
||||||
|
|
||||||
|
django.setup()
|
||||||
|
application = get_default_application()
|
20
gestioasso/routing.py
Normal file
20
gestioasso/routing.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
from channels.auth import AuthMiddlewareStack
|
||||||
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from kfet.routing import KFRouter
|
||||||
|
|
||||||
|
application = ProtocolTypeRouter(
|
||||||
|
{
|
||||||
|
# WebSocket chat handler
|
||||||
|
"websocket": AuthMiddlewareStack(
|
||||||
|
URLRouter(
|
||||||
|
[
|
||||||
|
path("ws/k-fet", KFRouter),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"http": get_asgi_application(),
|
||||||
|
}
|
||||||
|
)
|
|
@ -1,7 +1,9 @@
|
||||||
"""
|
"""
|
||||||
Django development settings for the cof project.
|
Settings de production de GestioBDS.
|
||||||
The settings that are not listed here are imported from .common
|
|
||||||
|
Surcharge les settings définis dans common.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .common import * # NOQA
|
from .common import * # NOQA
|
||||||
from .common import INSTALLED_APPS
|
from .common import INSTALLED_APPS
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
"""
|
"""
|
||||||
Django development settings for the cof project.
|
Settings de production de GestioCOF.
|
||||||
The settings that are not listed here are imported from .common
|
|
||||||
|
Surcharge les settings définis dans common.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from .common import * # NOQA
|
from .common import * # NOQA
|
||||||
from .common import (
|
from .common import (
|
||||||
|
@ -23,8 +28,8 @@ REDIS_DB = import_secret("REDIS_DB")
|
||||||
REDIS_HOST = import_secret("REDIS_HOST")
|
REDIS_HOST = import_secret("REDIS_HOST")
|
||||||
REDIS_PORT = import_secret("REDIS_PORT")
|
REDIS_PORT = import_secret("REDIS_PORT")
|
||||||
|
|
||||||
RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY")
|
HCAPTCHA_SITEKEY = import_secret("HCAPTCHA_SITEKEY")
|
||||||
RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY")
|
HCAPTCHA_SECRET = import_secret("HCAPTCHA_SECRET")
|
||||||
KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN")
|
KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN")
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
@ -47,7 +52,7 @@ INSTALLED_APPS = (
|
||||||
+ [
|
+ [
|
||||||
"bda",
|
"bda",
|
||||||
"petitscours",
|
"petitscours",
|
||||||
"captcha",
|
"hcaptcha",
|
||||||
"kfet",
|
"kfet",
|
||||||
"kfet.open",
|
"kfet.open",
|
||||||
"channels",
|
"channels",
|
||||||
|
@ -80,7 +85,6 @@ MIDDLEWARE = (
|
||||||
+ MIDDLEWARE
|
+ MIDDLEWARE
|
||||||
+ [
|
+ [
|
||||||
"djconfig.middleware.DjConfigMiddleware",
|
"djconfig.middleware.DjConfigMiddleware",
|
||||||
"wagtail.core.middleware.SiteMiddleware",
|
|
||||||
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -104,15 +108,23 @@ MEDIA_URL = "/gestion/media/"
|
||||||
CORS_ORIGIN_WHITELIST = ("bda.ens.fr", "www.bda.ens.fr" "cof.ens.fr", "www.cof.ens.fr")
|
CORS_ORIGIN_WHITELIST = ("bda.ens.fr", "www.bda.ens.fr" "cof.ens.fr", "www.cof.ens.fr")
|
||||||
|
|
||||||
|
|
||||||
|
ASGI_APPLICATION = "gestioasso.routing.application"
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Auth-related stuff
|
# Auth-related stuff
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS += [
|
AUTHENTICATION_BACKENDS = (
|
||||||
"gestioncof.shared.COFCASBackend",
|
[
|
||||||
"kfet.auth.backends.GenericBackend",
|
# Must be in first
|
||||||
]
|
"kfet.auth.backends.BlockFrozenAccountBackend"
|
||||||
|
]
|
||||||
|
+ AUTHENTICATION_BACKENDS
|
||||||
|
+ [
|
||||||
|
"gestioncof.shared.COFCASBackend",
|
||||||
|
"kfet.auth.backends.GenericBackend",
|
||||||
|
]
|
||||||
|
)
|
||||||
LOGIN_URL = "cof-login"
|
LOGIN_URL = "cof-login"
|
||||||
LOGIN_REDIRECT_URL = "home"
|
LOGIN_REDIRECT_URL = "home"
|
||||||
|
|
||||||
|
@ -136,7 +148,7 @@ CACHES = {
|
||||||
|
|
||||||
CHANNEL_LAYERS = {
|
CHANNEL_LAYERS = {
|
||||||
"default": {
|
"default": {
|
||||||
"BACKEND": "asgi_redis.RedisChannelLayer",
|
"BACKEND": "shared.channels.ChannelLayer",
|
||||||
"CONFIG": {
|
"CONFIG": {
|
||||||
"hosts": [
|
"hosts": [
|
||||||
(
|
(
|
||||||
|
@ -149,11 +161,9 @@ CHANNEL_LAYERS = {
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ROUTING": "cof.routing.routing",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# reCAPTCHA settings
|
# reCAPTCHA settings
|
||||||
# https://github.com/praekelt/django-recaptcha
|
# https://github.com/praekelt/django-recaptcha
|
||||||
|
@ -195,8 +205,29 @@ MAIL_DATA = {
|
||||||
"REPLYTO": "cof@ens.fr",
|
"REPLYTO": "cof@ens.fr",
|
||||||
},
|
},
|
||||||
"rappels": {"FROM": "Le BdA <bda@ens.fr>", "REPLYTO": "Le BdA <bda@ens.fr>"},
|
"rappels": {"FROM": "Le BdA <bda@ens.fr>", "REPLYTO": "Le BdA <bda@ens.fr>"},
|
||||||
|
"kfet": {
|
||||||
|
"FROM": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||||
|
"REPLYTO": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||||
|
},
|
||||||
"revente": {
|
"revente": {
|
||||||
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
||||||
"REPLYTO": "BdA-Revente <bda-revente@ens.fr>",
|
"REPLYTO": "BdA-Revente <bda-revente@ens.fr>",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# kfet history limits
|
||||||
|
# ---
|
||||||
|
|
||||||
|
# L'historique n'est accesible que d'aujourd'hui
|
||||||
|
# à aujourd'hui - KFET_HISTORY_DATE_LIMIT
|
||||||
|
KFET_HISTORY_DATE_LIMIT = timedelta(days=7)
|
||||||
|
|
||||||
|
# Limite plus longue pour les chefs/trez
|
||||||
|
# (qui ont la permission kfet.access_old_history)
|
||||||
|
KFET_HISTORY_LONG_DATE_LIMIT = timedelta(days=30)
|
||||||
|
|
||||||
|
# These accounts don't represent actual people and can be freely accessed
|
||||||
|
# Identification based on trigrammes
|
||||||
|
KFET_HISTORY_NO_DATE_LIMIT_TRIGRAMMES = ["LIQ", "#13"]
|
||||||
|
KFET_HISTORY_NO_DATE_LIMIT = timezone.datetime(1794, 10, 30) # AKA the distant past
|
|
@ -1,8 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Django common settings for cof project.
|
Settings par défaut et settings communs à GestioCOF et GestioBDS.
|
||||||
|
|
||||||
Everything which is supposed to be identical between the production server and
|
|
||||||
the local development server should be here.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -65,7 +62,7 @@ INSTALLED_APPS = [
|
||||||
"django.contrib.messages",
|
"django.contrib.messages",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.admindocs",
|
"django.contrib.admindocs",
|
||||||
"cof.apps.IgnoreSrcStaticFilesConfig",
|
"gestioasso.apps.IgnoreSrcStaticFilesConfig",
|
||||||
"django_cas_ng",
|
"django_cas_ng",
|
||||||
"bootstrapform",
|
"bootstrapform",
|
||||||
"widget_tweaks",
|
"widget_tweaks",
|
||||||
|
@ -82,7 +79,7 @@ MIDDLEWARE = [
|
||||||
"django.middleware.locale.LocaleMiddleware",
|
"django.middleware.locale.LocaleMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = "cof.urls"
|
ROOT_URLCONF = "gestioasso.urls"
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
|
@ -104,7 +101,7 @@ TEMPLATES = [
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
"ENGINE": "django.db.backends.postgresql",
|
||||||
"NAME": DBNAME,
|
"NAME": DBNAME,
|
||||||
"USER": DBUSER,
|
"USER": DBUSER,
|
||||||
"PASSWORD": DBPASSWD,
|
"PASSWORD": DBPASSWD,
|
||||||
|
@ -114,6 +111,7 @@ DATABASES = {
|
||||||
|
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Internationalization
|
# Internationalization
|
||||||
|
@ -126,7 +124,7 @@ USE_I18N = True
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
LANGUAGES = (("fr", "Français"), ("en", "English"))
|
LANGUAGES = (("fr", "Français"), ("en", "English"))
|
||||||
FORMAT_MODULE_PATH = "cof.locale"
|
FORMAT_MODULE_PATH = "gestioasso.locale"
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
|
@ -1,4 +1,10 @@
|
||||||
"""Django local development settings."""
|
"""
|
||||||
|
Settings utilisés dans la VM Vagrant.
|
||||||
|
Active toutes les applications (de GestioCOF et de GestioBDS).
|
||||||
|
|
||||||
|
Surcharge les settings définis dans common.py
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from . import bds_prod
|
from . import bds_prod
|
|
@ -1,4 +1,9 @@
|
||||||
"""Django local development settings."""
|
"""
|
||||||
|
Settings utilisés lors d'un développement en local (dans un virtualenv).
|
||||||
|
Active toutes les applications (de GestioCOF et de GestioBDS).
|
||||||
|
|
||||||
|
Surcharge les settings définis dans common.py
|
||||||
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from . import bds_prod
|
from . import bds_prod
|
||||||
|
@ -42,8 +47,7 @@ CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"
|
||||||
# Use the default in memory asgi backend for local development
|
# Use the default in memory asgi backend for local development
|
||||||
CHANNEL_LAYERS = {
|
CHANNEL_LAYERS = {
|
||||||
"default": {
|
"default": {
|
||||||
"BACKEND": "asgiref.inmemory.ChannelLayer",
|
"BACKEND": "channels.layers.InMemoryChannelLayer",
|
||||||
"ROUTING": "cof.routing.routing",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Secrets à re-définir en production.
|
||||||
|
"""
|
||||||
|
|
||||||
SECRET_KEY = "q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah"
|
SECRET_KEY = "q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah"
|
||||||
ADMINS = None
|
ADMINS = None
|
||||||
SERVER_EMAIL = "root@vagrant"
|
SERVER_EMAIL = "root@vagrant"
|
||||||
|
@ -12,8 +16,8 @@ REDIS_PORT = 6379
|
||||||
REDIS_DB = 0
|
REDIS_DB = 0
|
||||||
REDIS_HOST = "127.0.0.1"
|
REDIS_HOST = "127.0.0.1"
|
||||||
|
|
||||||
RECAPTCHA_PUBLIC_KEY = "DUMMY"
|
HCAPTCHA_SITEKEY = "10000000-ffff-ffff-ffff-000000000001"
|
||||||
RECAPTCHA_PRIVATE_KEY = "DUMMY"
|
HCAPTCHA_SECRET = "0x0000000000000000000000000000000000000000"
|
||||||
|
|
||||||
EMAIL_HOST = None
|
EMAIL_HOST = None
|
||||||
|
|
|
@ -8,20 +8,22 @@ from django.contrib import admin
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from django.views.generic.base import RedirectView
|
from django.views.generic.base import RedirectView
|
||||||
|
|
||||||
|
bds_is_alone = (
|
||||||
|
"bds" in settings.INSTALLED_APPS and "gestioncof" not in settings.INSTALLED_APPS
|
||||||
|
)
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# Redirection / → /gestion, only useful for developpers.
|
|
||||||
path("", RedirectView.as_view(url="gestion/")),
|
|
||||||
# Website administration (independent from installed apps)
|
# Website administration (independent from installed apps)
|
||||||
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
||||||
# App-specific urls
|
if not bds_is_alone:
|
||||||
|
# Redirection / → /gestion, only useful for developpers.
|
||||||
|
urlpatterns.append(path("", RedirectView.as_view(url="gestion/")))
|
||||||
|
|
||||||
bds_is_alone = (
|
# App-specific urls
|
||||||
"bds" in settings.INSTALLED_APPS and "gestioncof" not in settings.INSTALLED_APPS
|
|
||||||
)
|
|
||||||
|
|
||||||
app_dict = {
|
app_dict = {
|
||||||
"bds": "" if bds_is_alone else "bds/",
|
"bds": "" if bds_is_alone else "bds/",
|
||||||
|
@ -33,7 +35,7 @@ app_dict = {
|
||||||
"events": "gestion/event_v2/", # the events module is still experimental !
|
"events": "gestion/event_v2/", # the events module is still experimental !
|
||||||
"authens": "gestion/authens/",
|
"authens": "gestion/authens/",
|
||||||
}
|
}
|
||||||
for (app_name, url_prefix) in app_dict.items():
|
for app_name, url_prefix in app_dict.items():
|
||||||
if app_name in settings.INSTALLED_APPS:
|
if app_name in settings.INSTALLED_APPS:
|
||||||
urlpatterns += [path(url_prefix, include("{}.urls".format(app_name)))]
|
urlpatterns += [path(url_prefix, include("{}.urls".format(app_name)))]
|
||||||
|
|
|
@ -2,5 +2,5 @@ import os
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cof.settings.bds_prod")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gestioasso.settings.bds_prod")
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
|
@ -1 +0,0 @@
|
||||||
default_app_config = "gestioncof.apps.GestioncofConfig"
|
|
|
@ -6,7 +6,7 @@ from django.contrib.auth.models import Group, Permission, User
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from gestioncof.models import (
|
from gestioncof.models import (
|
||||||
Club,
|
Club,
|
||||||
|
@ -100,28 +100,6 @@ class CofProfileInline(admin.StackedInline):
|
||||||
inline_classes = ("collapse open",)
|
inline_classes = ("collapse open",)
|
||||||
|
|
||||||
|
|
||||||
class FkeyLookup(object):
|
|
||||||
def __init__(self, fkeydecl, short_description=None, admin_order_field=None):
|
|
||||||
self.fk, fkattrs = fkeydecl.split("__", 1)
|
|
||||||
self.fkattrs = fkattrs.split("__")
|
|
||||||
|
|
||||||
self.short_description = short_description or self.fkattrs[-1]
|
|
||||||
self.admin_order_field = admin_order_field or fkeydecl
|
|
||||||
|
|
||||||
def __get__(self, obj, klass):
|
|
||||||
if obj is None:
|
|
||||||
"""
|
|
||||||
hack required to make Django validate (if obj is
|
|
||||||
None, then we're a class, and classes are callable
|
|
||||||
<wink>)
|
|
||||||
"""
|
|
||||||
return self
|
|
||||||
item = getattr(obj, self.fk)
|
|
||||||
for attr in self.fkattrs:
|
|
||||||
item = getattr(item, attr)
|
|
||||||
return item
|
|
||||||
|
|
||||||
|
|
||||||
def ProfileInfo(field, short_description, boolean=False):
|
def ProfileInfo(field, short_description, boolean=False):
|
||||||
def getter(self):
|
def getter(self):
|
||||||
try:
|
try:
|
||||||
|
@ -134,7 +112,6 @@ def ProfileInfo(field, short_description, boolean=False):
|
||||||
return getter
|
return getter
|
||||||
|
|
||||||
|
|
||||||
User.profile_login_clipper = FkeyLookup("profile__login_clipper", "Login clipper")
|
|
||||||
User.profile_phone = ProfileInfo("phone", "Téléphone")
|
User.profile_phone = ProfileInfo("phone", "Téléphone")
|
||||||
User.profile_occupation = ProfileInfo("occupation", "Occupation")
|
User.profile_occupation = ProfileInfo("occupation", "Occupation")
|
||||||
User.profile_departement = ProfileInfo("departement", "Departement")
|
User.profile_departement = ProfileInfo("departement", "Departement")
|
||||||
|
@ -163,7 +140,6 @@ class UserProfileAdmin(UserAdmin):
|
||||||
is_cof.boolean = True
|
is_cof.boolean = True
|
||||||
|
|
||||||
list_display = UserAdmin.list_display + (
|
list_display = UserAdmin.list_display + (
|
||||||
"profile_login_clipper",
|
|
||||||
"profile_phone",
|
"profile_phone",
|
||||||
"profile_occupation",
|
"profile_occupation",
|
||||||
"profile_mailing_cof",
|
"profile_mailing_cof",
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
default_app_config = "gestioncof.cms.apps.COFCMSAppConfig"
|
|
|
@ -13,7 +13,6 @@ import gestioncof.cms.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("cofcms", "0001_initial")]
|
dependencies = [("cofcms", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("cofcms", "0002_auto_20190523_1521"),
|
("cofcms", "0002_auto_20190523_1521"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("cofcms", "0003_directory_entry_optional_links"),
|
("cofcms", "0003_directory_entry_optional_links"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -33,19 +33,19 @@
|
||||||
<nav>
|
<nav>
|
||||||
{% flat_menu "cof-nav-int" template="cofcms/base_nav.html" apply_active_classes=True %}
|
{% flat_menu "cof-nav-int" template="cofcms/base_nav.html" apply_active_classes=True %}
|
||||||
|
|
||||||
{% get_current_language as curlang %}
|
{% get_current_language as curlang %}
|
||||||
|
|
||||||
<div class="lang-select">
|
<div class="lang-select">
|
||||||
{% if curlang == 'en' %}
|
{% if curlang == 'en' %}
|
||||||
{% language 'fr' %}
|
{% language 'fr' %}
|
||||||
<a href="{% pageurl self %}" title="Français"><img src="{% static "cofcms/images/fr.png" %}"></a>
|
<a href="{% pageurl self %}" title="Français"><img src="{% static "cofcms/images/fr.png" %}"></a>
|
||||||
{% endlanguage %}
|
{% endlanguage %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% language 'en' %}
|
{% language 'en' %}
|
||||||
<a href="{% pageurl self %}" title="English"><img src="{% static "cofcms/images/en.png" %}"></a>
|
<a href="{% pageurl self %}" title="English"><img src="{% static "cofcms/images/en.png" %}"></a>
|
||||||
{% endlanguage %}
|
{% endlanguage %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -17,16 +17,16 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="intro">
|
<section class="intro">
|
||||||
<h1>{{ page.title }}</h1>
|
<h1>{{ page.title }}</h1>
|
||||||
<div>{{ page.introduction|safe }}</div>
|
<div>{{ page.introduction|richtext }}</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="actulist">
|
<section class="actulist">
|
||||||
{% if actus.has_previous %}
|
{% if actus.has_previous %}
|
||||||
<a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a>
|
<a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if actus.has_next %}
|
{% if actus.has_next %}
|
||||||
<a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a>
|
<a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for actu in page.actus %}
|
{% for actu in page.actus %}
|
||||||
<article class="actu">
|
<article class="actu">
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
{% if actu.is_event %}
|
{% if actu.is_event %}
|
||||||
<p><span class="actu-dates">{{ actu|dates|capfirst }}</span><br />{{ actu.chapo }}</p>
|
<p><span class="actu-dates">{{ actu|dates|capfirst }}</span><br />{{ actu.chapo }}</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ actu.body|safe|truncatewords_html:15 }}
|
{{ actu.body|richtext|truncatewords_html:15 }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% pageurl actu %}">{% trans "Lire plus" %} ></a>
|
<a href="{% pageurl actu %}">{% trans "Lire plus" %} ></a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if actus.has_previous %}
|
{% if actus.has_previous %}
|
||||||
<a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a>
|
<a class="block prev-actus" href="?page={{ actus.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus récentes" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if actus.has_next %}
|
{% if actus.has_next %}
|
||||||
<a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a>
|
<a class="block next-actus" href="?page={{ actus.next_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">{% trans "Actualités plus anciennes" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "cofcms/base.html" %}
|
{% extends "cofcms/base.html" %}
|
||||||
{% load wagtailimages_tags cofcms_tags i18n %}
|
{% load wagtailcore_tags wagtailimages_tags cofcms_tags i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="intro">
|
<section class="intro">
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<section class="pagecontent">
|
<section class="pagecontent">
|
||||||
<div class="image">{% image page.image width-700 %}</div>
|
<div class="image">{% image page.image width-700 %}</div>
|
||||||
<article>
|
<article>
|
||||||
{{ page.body|safe }}
|
{{ page.body|richtext }}
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "cofcms/base_aside.html" %}
|
{% extends "cofcms/base_aside.html" %}
|
||||||
{% load wagtailimages_tags cofcms_tags static i18n %}
|
{% load wagtailcore_tags wagtailimages_tags cofcms_tags static i18n %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="intro">
|
<section class="intro">
|
||||||
<h1>{{ page.title }}</h1>
|
<h1>{{ page.title }}</h1>
|
||||||
<div>{{ page.introduction|safe }}</div>
|
<div>{{ page.introduction|richtext }}</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="directory">
|
<section class="directory">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<div class="entry-image">{% image entry.image width-150 class="entry-img" %}</div>
|
<div class="entry-image">{% image entry.image width-150 class="entry-img" %}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>{{ entry.title }}</h2>
|
<h2>{{ entry.title }}</h2>
|
||||||
<div class="desc">{{ entry.body|safe }}</div>
|
<div class="desc">{{ entry.body|richtext }}</div>
|
||||||
{% if entry.links %}
|
{% if entry.links %}
|
||||||
<ul class="links">
|
<ul class="links">
|
||||||
{% for block in entry.links %}
|
{% for block in entry.links %}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue