forked from DGNum/gestioCOF
Compare commits
102 commits
Aufinal/ba
...
master
Author | SHA1 | Date | |
---|---|---|---|
thubrecht | 69976a878a | ||
Antoine Groudiev | 6621ae3950 | ||
Antoine Groudiev | 9288daaf9e | ||
Tom Hubrecht | e92c500940 | ||
d75eaf583f | |||
soyouzpanda | 55bd3ab51d | ||
f640a25f59 | |||
f881c7cd8b | |||
Tom Hubrecht | b548b87c25 | ||
a72302291f | |||
Tom Hubrecht | a0bde75f50 | ||
44b19c12e5 | |||
Tom Hubrecht | f97d339a1c | ||
094116e88d | |||
Tom Hubrecht | b32a07fc22 | ||
4fc9902cf6 | |||
Tom Hubrecht | 7164cfa37a | ||
90f96fb5c9 | |||
Tom Hubrecht | e50249355d | ||
c304d734d9 | |||
Tom Hubrecht | c36dd30bce | ||
Tom Hubrecht | 2571cc955e | ||
Tom Hubrecht | 3eaac5c68f | ||
Tom Hubrecht | af4c8e0744 | ||
Tom Hubrecht | 14e0a3ef0a | ||
83078d4726 | |||
Tom Hubrecht | cb262ad479 | ||
Tom Hubrecht | 5c47118834 | ||
Tom Hubrecht | 30e842ce80 | ||
Tom Hubrecht | 892bf51163 | ||
Tom Hubrecht | e20d7ca6c2 | ||
1b09293206 | |||
e7da476697 | |||
761ab6df90 | |||
a8d4035d33 | |||
Alice | b80426c56f | ||
Alice | 429e611daa | ||
5160da7862 | |||
Alice | aad3775222 | ||
Alice | 4b92716092 | ||
Tom Hubrecht | dfa5b4bf69 | ||
1be5dcb6af | |||
Tom Hubrecht | a891ec56a6 | ||
Tom Hubrecht | 7a52690a63 | ||
Tom Hubrecht | a2f396ce7a | ||
Tom Hubrecht | 85e30056a6 | ||
69de48f285 | |||
eba36f2712 | |||
bfdb34aae7 | |||
Tom Hubrecht | fcf2002cd7 | ||
Tom Hubrecht | b236d6a950 | ||
Tom Hubrecht | 4b29097f02 | ||
Tom Hubrecht | 87f383bef1 | ||
1ad025e046 | |||
b3c047738a | |||
17a9ae3302 | |||
e41bcbb6d7 | |||
e384bfb0f3 | |||
Tom Hubrecht | 373ff1f62c | ||
65eb95a3c9 | |||
1c880b265e | |||
75fbdc7efb | |||
Tom Hubrecht | 1b8dd971b0 | ||
Tom Hubrecht | 713d686047 | ||
77aa269c90 | |||
9a143521d5 | |||
a77cf59b18 | |||
d8cabda678 | |||
f086140dad | |||
4d1ae8f540 | |||
6d824a58be | |||
Tom Hubrecht | 20880114aa | ||
df180d7446 | |||
Tom Hubrecht | ef1793a348 | ||
Tom Hubrecht | 2d677b2093 | ||
Tom Hubrecht | f70eacfc37 | ||
Tom Hubrecht | 264a0a852f | ||
Tom Hubrecht | 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 |
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -5,6 +5,7 @@ cof/settings.py
|
||||||
settings.py
|
settings.py
|
||||||
*~
|
*~
|
||||||
venv/
|
venv/
|
||||||
|
.venv/
|
||||||
.vagrant
|
.vagrant
|
||||||
/src
|
/src
|
||||||
media/
|
media/
|
||||||
|
@ -18,4 +19,5 @@ media/
|
||||||
.cache
|
.cache
|
||||||
|
|
||||||
# VSCode
|
# VSCode
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.direnv
|
||||||
|
|
74
CHANGELOG.md
74
CHANGELOG.md
|
@ -21,20 +21,82 @@ 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 0.11
|
## TODO Prod
|
||||||
|
|
||||||
|
- 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
|
### 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
|
||||||
|
|
||||||
|
## 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
|
- 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
|
- 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
|
## Version 0.10 - 18/04/2021
|
||||||
|
|
||||||
### TODO Prod
|
|
||||||
|
|
||||||
- Créer un compte hCaptcha (https://www.hcaptcha.com/), au COF, et remplacer les secrets associés
|
|
||||||
|
|
||||||
### K-Fêt
|
### K-Fêt
|
||||||
|
|
||||||
- On fait sauter la limite qui empêchait de vendre plus de 24 unités d'un item à
|
- On fait sauter la limite qui empêchait de vendre plus de 24 unités d'un item à
|
||||||
|
|
|
@ -211,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",
|
||||||
|
|
|
@ -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"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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] = []
|
||||||
|
|
|
@ -36,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")
|
||||||
|
|
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 %}
|
|
@ -36,6 +36,8 @@
|
||||||
|
|
||||||
<a class=button href="{% url 'bds:export.members' %}">Télécharger la liste des membres (CSV)</a>
|
<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>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
|
@ -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 %}
|
||||||
|
|
|
@ -27,7 +27,9 @@ class TestHomeView(TestCase):
|
||||||
def test_get(self, mock_messages):
|
def test_get(self, mock_messages):
|
||||||
user = User.objects.create_user(username="random_user")
|
user = User.objects.create_user(username="random_user")
|
||||||
give_bds_buro_permissions(user)
|
give_bds_buro_permissions(user)
|
||||||
self.client.force_login(user)
|
self.client.force_login(
|
||||||
|
user, backend="django.contrib.auth.backends.ModelBackend"
|
||||||
|
)
|
||||||
resp = self.client.get(reverse("bds:home"))
|
resp = self.client.get(reverse("bds:home"))
|
||||||
self.assertEquals(resp.status_code, 200)
|
self.assertEquals(resp.status_code, 200)
|
||||||
|
|
||||||
|
@ -44,7 +46,7 @@ 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.assertEquals(resp.status_code, 403)
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ 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.assertEquals(resp.status_code, 403)
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,10 @@ urlpatterns = [
|
||||||
),
|
),
|
||||||
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", 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"),
|
||||||
]
|
]
|
||||||
|
|
25
bds/views.py
25
bds/views.py
|
@ -8,7 +8,7 @@ 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
|
||||||
|
@ -30,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
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,6 +144,28 @@ class UserDeleteView(StaffRequiredMixin, DeleteView):
|
||||||
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")
|
@permission_required("bds.is_team")
|
||||||
def export_members(request):
|
def export_members(request):
|
||||||
response = HttpResponse(content_type="text/csv")
|
response = HttpResponse(content_type="text/csv")
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
|
@ -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"),
|
||||||
|
|
|
@ -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])
|
||||||
|
|
|
@ -7,6 +7,8 @@ Surcharge les settings définis dans common.py
|
||||||
import os
|
import os
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from .common import * # NOQA
|
from .common import * # NOQA
|
||||||
from .common import (
|
from .common import (
|
||||||
AUTHENTICATION_BACKENDS,
|
AUTHENTICATION_BACKENDS,
|
||||||
|
@ -111,11 +113,17 @@ CORS_ORIGIN_WHITELIST = ("bda.ens.fr", "www.bda.ens.fr" "cof.ens.fr", "www.cof.e
|
||||||
# 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"
|
||||||
|
|
||||||
|
@ -198,6 +206,10 @@ 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>",
|
||||||
|
@ -215,3 +227,8 @@ KFET_HISTORY_DATE_LIMIT = timedelta(days=7)
|
||||||
# Limite plus longue pour les chefs/trez
|
# Limite plus longue pour les chefs/trez
|
||||||
# (qui ont la permission kfet.access_old_history)
|
# (qui ont la permission kfet.access_old_history)
|
||||||
KFET_HISTORY_LONG_DATE_LIMIT = timedelta(days=30)
|
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
|
||||||
|
|
|
@ -35,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)))]
|
||||||
|
|
||||||
|
|
|
@ -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"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "fonts/SourceSansPro/sourceSansPro.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "fonts/SourceSansPro/sourceSansPro.css" %}"/>
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/>
|
||||||
{% block extra_head %}{% endblock %}
|
{% block extra_head %}{% endblock %}
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0; minimum-scale=1.0;">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0; minimum-scale=1.0;">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -32,27 +32,27 @@
|
||||||
<section class="bottom-menu">
|
<section class="bottom-menu">
|
||||||
<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 %}
|
|
||||||
|
|
||||||
<div class="lang-select">
|
{% get_current_language as curlang %}
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% block superaside %}{% endblock %}
|
{% block superaside %}{% endblock %}
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,17 +17,17 @@
|
||||||
{% 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">
|
||||||
<div class="actu-image" {% if actu.image %}{% image actu.image fill-400x200 as img %}style="background-image:url('{{ img.url }}');"{% endif %}></div>
|
<div class="actu-image" {% if actu.image %}{% image actu.image fill-400x200 as img %}style="background-image:url('{{ img.url }}');"{% endif %}></div>
|
||||||
|
@ -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 %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{% extends "cofcms/base.html" %}
|
{% extends "cofcms/base.html" %}
|
||||||
{% load wagtailimages_tags cofcms_tags %}
|
{% load wagtailcore_tags wagtailimages_tags cofcms_tags %}
|
||||||
|
|
||||||
{% 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="pagecontent">
|
<section class="pagecontent">
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<h2>{{ block.value }}</h2>
|
<h2>{{ block.value }}</h2>
|
||||||
{% elif block.block_type == "paragraph" %}
|
{% elif block.block_type == "paragraph" %}
|
||||||
<article class="paragraph">
|
<article class="paragraph">
|
||||||
{{ block.value|safe }}
|
{{ block.value|richtext }}
|
||||||
</article>
|
</article>
|
||||||
{% elif block.block_type == "image" %}
|
{% elif block.block_type == "image" %}
|
||||||
<div class="image">
|
<div class="image">
|
||||||
|
|
|
@ -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="actuhome">
|
<section class="actuhome">
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
{% if actu.is_event %}
|
{% if actu.is_event %}
|
||||||
<span class="actu-minical">{% mini_calendar actu %}</span><span class="actu-dates">{{ actu|dates }}</span>
|
<span class="actu-minical">{% mini_calendar actu %}</span><span class="actu-dates">{{ actu|dates }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ actu.body|safe|truncatewords_html:10 }}
|
{{ actu.body|richtext|truncatewords_html:10 }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<a href="{% pageurl actu %}" class="actu-overlay"></a>
|
<a href="{% pageurl actu %}" class="actu-overlay"></a>
|
||||||
|
|
|
@ -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 = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0001_initial")]
|
dependencies = [("gestioncof", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0002_enable_unprocessed_demandes")]
|
dependencies = [("gestioncof", "0002_enable_unprocessed_demandes")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -25,7 +25,6 @@ def create_mail(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0003_event_image")]
|
dependencies = [("gestioncof", "0003_event_image")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0004_registration_mail")]
|
dependencies = [("gestioncof", "0004_registration_mail")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("bda", "0004_mails-rappel"),
|
("bda", "0004_mails-rappel"),
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0006_add_calendar")]
|
dependencies = [("gestioncof", "0006_add_calendar")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,6 @@ def forwards(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0007_alter_club")]
|
dependencies = [("gestioncof", "0007_alter_club")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0008_py3")]
|
dependencies = [("gestioncof", "0008_py3")]
|
||||||
|
|
||||||
operations = [migrations.DeleteModel(name="Clipper")]
|
operations = [migrations.DeleteModel(name="Clipper")]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0009_delete_clipper")]
|
dependencies = [("gestioncof", "0009_delete_clipper")]
|
||||||
|
|
||||||
operations = [migrations.DeleteModel(name="CustomMail")]
|
operations = [migrations.DeleteModel(name="CustomMail")]
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0010_delete_custommail")]
|
dependencies = [("gestioncof", "0010_delete_custommail")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0010_delete_custommail")]
|
dependencies = [("gestioncof", "0010_delete_custommail")]
|
||||||
|
|
||||||
operations = [migrations.RemoveField(model_name="cofprofile", name="num")]
|
operations = [migrations.RemoveField(model_name="cofprofile", name="num")]
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("gestioncof", "0011_remove_cofprofile_num"),
|
("gestioncof", "0011_remove_cofprofile_num"),
|
||||||
("gestioncof", "0011_longer_clippers"),
|
("gestioncof", "0011_longer_clippers"),
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0012_merge")]
|
dependencies = [("gestioncof", "0012_merge")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0013_pei")]
|
dependencies = [("gestioncof", "0013_pei")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0014_cofprofile_mailing_unernestaparis")]
|
dependencies = [("gestioncof", "0014_cofprofile_mailing_unernestaparis")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -16,7 +16,6 @@ def null_clippers_to_empty(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0015_psql_choices_niveaux")]
|
dependencies = [("gestioncof", "0015_psql_choices_niveaux")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -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),
|
||||||
("gestioncof", "0016_unique_clippers"),
|
("gestioncof", "0016_unique_clippers"),
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("gestioncof", "0017_petitscours_uniqueness"),
|
("gestioncof", "0017_petitscours_uniqueness"),
|
||||||
]
|
]
|
||||||
|
|
19
gestioncof/migrations/0019_cofprofile_date_adhesion.py
Normal file
19
gestioncof/migrations/0019_cofprofile_date_adhesion.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 2.2.28 on 2023-05-22 09:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("gestioncof", "0018_petitscours_email"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="cofprofile",
|
||||||
|
name="date_adhesion",
|
||||||
|
field=models.DateField(
|
||||||
|
blank=True, null=True, verbose_name="Date d'adhésion"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -50,6 +50,7 @@ class CofProfile(models.Model):
|
||||||
"Login clipper", max_length=32, blank=True, unique=True, null=True
|
"Login clipper", max_length=32, blank=True, unique=True, null=True
|
||||||
)
|
)
|
||||||
is_cof = models.BooleanField("Membre du COF", default=False)
|
is_cof = models.BooleanField("Membre du COF", default=False)
|
||||||
|
date_adhesion = models.DateField("Date d'adhésion", blank=True, null=True)
|
||||||
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
||||||
occupation = models.CharField(
|
occupation = models.CharField(
|
||||||
_("Occupation"),
|
_("Occupation"),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import timedelta
|
from datetime import date, timedelta
|
||||||
|
|
||||||
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
|
||||||
|
@ -484,6 +484,7 @@ class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
||||||
u1.last_name = "last"
|
u1.last_name = "last"
|
||||||
u1.email = "user@mail.net"
|
u1.email = "user@mail.net"
|
||||||
u1.save()
|
u1.save()
|
||||||
|
u1.profile.date_adhesion = date(2023, 5, 22)
|
||||||
u1.profile.phone = "0123456789"
|
u1.profile.phone = "0123456789"
|
||||||
u1.profile.departement = "Dept"
|
u1.profile.departement = "Dept"
|
||||||
u1.profile.save()
|
u1.profile.save()
|
||||||
|
@ -505,8 +506,9 @@ class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
||||||
"1A",
|
"1A",
|
||||||
"Dept",
|
"Dept",
|
||||||
"normalien",
|
"normalien",
|
||||||
|
"2023-05-22",
|
||||||
],
|
],
|
||||||
[str(u2.pk), "staff", "", "", "", "", "1A", "", "normalien"],
|
[str(u2.pk), "staff", "", "", "", "", "1A", "", "normalien", "None"],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -548,7 +550,6 @@ class ExportMegaOrgasViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
||||||
auth_forbidden = [None, "user", "member"]
|
auth_forbidden = [None, "user", "member"]
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
|
|
||||||
r = self.client.get(self.url)
|
r = self.client.get(self.url)
|
||||||
|
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
@ -641,7 +642,7 @@ class ClubListViewTests(ViewTestCaseMixin, TestCase):
|
||||||
def test_as_staff(self):
|
def test_as_staff(self):
|
||||||
u = self.users["staff"]
|
u = self.users["staff"]
|
||||||
c = Client()
|
c = Client()
|
||||||
c.force_login(u)
|
c.force_login(u, backend="django.contrib.auth.backends.ModelBackend")
|
||||||
|
|
||||||
r = c.get(self.url)
|
r = c.get(self.url)
|
||||||
|
|
||||||
|
@ -686,7 +687,7 @@ class ClubMembersViewTests(ViewTestCaseMixin, TestCase):
|
||||||
self.c.respos.add(u)
|
self.c.respos.add(u)
|
||||||
|
|
||||||
c = Client()
|
c = Client()
|
||||||
c.force_login(u)
|
c.force_login(u, backend="django.contrib.auth.backends.ModelBackend")
|
||||||
r = c.get(self.url)
|
r = c.get(self.url)
|
||||||
|
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import csv
|
import csv
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import timedelta
|
from datetime import date, timedelta
|
||||||
from smtplib import SMTPRecipientsRefused
|
from smtplib import SMTPRecipientsRefused
|
||||||
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
|
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ class ResetComptes(BuroRequiredMixin, TemplateView):
|
||||||
nb_adherents = CofProfile.objects.filter(is_cof=True).count()
|
nb_adherents = CofProfile.objects.filter(is_cof=True).count()
|
||||||
CofProfile.objects.update(
|
CofProfile.objects.update(
|
||||||
is_cof=False,
|
is_cof=False,
|
||||||
|
date_adhesion=None,
|
||||||
mailing_cof=False,
|
mailing_cof=False,
|
||||||
mailing_bda=False,
|
mailing_bda=False,
|
||||||
mailing_bda_revente=False,
|
mailing_bda_revente=False,
|
||||||
|
@ -575,6 +576,9 @@ def registration(request):
|
||||||
profile = profile_form.save()
|
profile = profile_form.save()
|
||||||
if profile.is_cof and not was_cof:
|
if profile.is_cof and not was_cof:
|
||||||
notify_new_member(request, member)
|
notify_new_member(request, member)
|
||||||
|
profile.date_adhesion = date.today()
|
||||||
|
profile.save()
|
||||||
|
|
||||||
# Enregistrement des inscriptions aux événements
|
# Enregistrement des inscriptions aux événements
|
||||||
for form in event_formset:
|
for form in event_formset:
|
||||||
if "status" not in form.cleaned_data:
|
if "status" not in form.cleaned_data:
|
||||||
|
@ -715,6 +719,7 @@ def export_members(request):
|
||||||
profile.occupation,
|
profile.occupation,
|
||||||
profile.departement,
|
profile.departement,
|
||||||
profile.type_cotiz,
|
profile.type_cotiz,
|
||||||
|
profile.date_adhesion,
|
||||||
]
|
]
|
||||||
writer.writerow([str(bit) for bit in bits])
|
writer.writerow([str(bit) for bit in bits])
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
|
|
||||||
from kfet.models import Account, GenericTeamToken
|
from kfet.models import Account, GenericTeamToken
|
||||||
|
|
||||||
|
@ -37,3 +38,36 @@ class GenericBackend(BaseKFetBackend):
|
||||||
team_token.delete()
|
team_token.delete()
|
||||||
|
|
||||||
return get_kfet_generic_user()
|
return get_kfet_generic_user()
|
||||||
|
|
||||||
|
|
||||||
|
class BlockFrozenAccountBackend:
|
||||||
|
def authenticate(self, request, **kwargs):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_user(self, user_id):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def has_perm(self, user_obj, perm, obj=None):
|
||||||
|
app_label, _ = perm.split(".")
|
||||||
|
if app_label == "kfet":
|
||||||
|
if (
|
||||||
|
hasattr(user_obj, "profile")
|
||||||
|
and hasattr(user_obj.profile, "account_kfet")
|
||||||
|
and user_obj.profile.account_kfet.is_frozen
|
||||||
|
):
|
||||||
|
raise PermissionDenied
|
||||||
|
|
||||||
|
# Dans le cas général, on se réfère aux autres backends
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_module_perms(self, user_obj, app_label):
|
||||||
|
if app_label == "kfet":
|
||||||
|
if (
|
||||||
|
hasattr(user_obj, "profile")
|
||||||
|
and hasattr(user_obj.profile, "account_kfet")
|
||||||
|
and user_obj.profile.account_kfet.is_frozen
|
||||||
|
):
|
||||||
|
raise PermissionDenied
|
||||||
|
|
||||||
|
# Dans le cas général, on se réfère aux autres backends
|
||||||
|
return False
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("auth", "0006_require_contenttypes_0002"),
|
("auth", "0006_require_contenttypes_0002"),
|
||||||
# Following dependency allows using Account model to set up the kfet
|
# Following dependency allows using Account model to set up the kfet
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("auth", "0011_update_proxy_permissions"),
|
("auth", "0011_update_proxy_permissions"),
|
||||||
("kfetauth", "0001_initial"),
|
("kfetauth", "0001_initial"),
|
||||||
|
|
|
@ -13,7 +13,6 @@ def existing_groups(apps, schema_editor):
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("kfetauth", "0002_kfetgroup_kfetpermission"),
|
("kfetauth", "0002_kfetgroup_kfetpermission"),
|
||||||
]
|
]
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,6 @@ class Command(BaseCommand):
|
||||||
parser.add_argument("--file", default="kfet_wagtail_02_19")
|
parser.add_argument("--file", default="kfet_wagtail_02_19")
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.stdout.write("Import des données wagtail")
|
self.stdout.write("Import des données wagtail")
|
||||||
|
|
||||||
# Nettoyage des données initiales posées par Wagtail dans la migration
|
# Nettoyage des données initiales posées par Wagtail dans la migration
|
||||||
|
|
|
@ -11,7 +11,6 @@ import kfet.cms.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("wagtailcore", "0033_remove_golive_expiry_help_text"),
|
("wagtailcore", "0033_remove_golive_expiry_help_text"),
|
||||||
("wagtailimages", "0019_delete_filter"),
|
("wagtailimages", "0019_delete_filter"),
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("kfetcms", "0001_initial")]
|
dependencies = [("kfetcms", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -97,7 +97,6 @@ class KFetStreamBlock(ChoicesStreamBlock):
|
||||||
|
|
||||||
|
|
||||||
class KFetPage(Page):
|
class KFetPage(Page):
|
||||||
|
|
||||||
content = StreamField(KFetStreamBlock, verbose_name=_("Contenu"))
|
content = StreamField(KFetStreamBlock, verbose_name=_("Contenu"))
|
||||||
|
|
||||||
# Layout fields
|
# Layout fields
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from datetime import timedelta
|
from datetime import date, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
@ -14,7 +14,6 @@ from djconfig.forms import ConfigForm
|
||||||
from gestioncof.models import CofProfile
|
from gestioncof.models import CofProfile
|
||||||
from kfet.models import (
|
from kfet.models import (
|
||||||
Account,
|
Account,
|
||||||
AccountNegative,
|
|
||||||
Article,
|
Article,
|
||||||
ArticleCategory,
|
ArticleCategory,
|
||||||
Checkout,
|
Checkout,
|
||||||
|
@ -46,12 +45,69 @@ class DateTimeWidget(forms.DateTimeInput):
|
||||||
js = ("kfet/vendor/bootstrap/bootstrap-datetimepicker.min.js",)
|
js = ("kfet/vendor/bootstrap/bootstrap-datetimepicker.min.js",)
|
||||||
|
|
||||||
|
|
||||||
|
class ContactForm(forms.Form):
|
||||||
|
from_email = forms.EmailField(
|
||||||
|
label="Adresse mail",
|
||||||
|
help_text="Si aucune adresse mail n'est renseignée, la soumission sera anonyme.",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
subject = forms.CharField(label="Objet", required=True)
|
||||||
|
message = forms.CharField(widget=forms.Textarea, required=True)
|
||||||
|
|
||||||
|
def clean_from_email(self):
|
||||||
|
return self.cleaned_data["from_email"] or "Anonyme <k-fet@ens.psl.eu>"
|
||||||
|
|
||||||
|
|
||||||
|
class DemandeSoireeForm(forms.Form):
|
||||||
|
HORAIRE_CHOICES = map(lambda s: (s, s), ("22h", "23h", "00h", "01h", "02h", "03h"))
|
||||||
|
SERVICE_CHOICES = (
|
||||||
|
("K-Fêt", "K-Fêt standard (L'équipe K-Fêt fait le service normal au bar)"),
|
||||||
|
("Kalô", "Type Kalô (Vous ramenez vos propres boissons et servez vous-mêmes)"),
|
||||||
|
)
|
||||||
|
|
||||||
|
nom = forms.CharField()
|
||||||
|
from_email = forms.EmailField(label="Adresse mail de contact")
|
||||||
|
|
||||||
|
contact_boum = forms.BooleanField(label="Contacter le Boum", required=False)
|
||||||
|
contact_pls = forms.BooleanField(label="Contacter PLS", required=False)
|
||||||
|
|
||||||
|
theme = forms.CharField(label="Thème de la soirée")
|
||||||
|
horaire_fin = forms.ChoiceField(label="Horaire de fin", choices=HORAIRE_CHOICES)
|
||||||
|
service = forms.ChoiceField(label="Mode de service", choices=SERVICE_CHOICES)
|
||||||
|
date = forms.CharField(label="Date souhaitée")
|
||||||
|
|
||||||
|
respo1 = forms.CharField(label="Nom de la personne respo n°1")
|
||||||
|
respo2 = forms.CharField(label="Nom de la personne respo n°2")
|
||||||
|
respo3 = forms.CharField(label="Nom de la personne respo n°3")
|
||||||
|
respo4 = forms.CharField(label="Nom de la personne respo n°4")
|
||||||
|
|
||||||
|
remarques = forms.CharField(
|
||||||
|
label="Remarques supplémentaires", widget=forms.Textarea
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Account forms
|
# Account forms
|
||||||
# -----
|
# -----
|
||||||
|
|
||||||
|
|
||||||
|
def default_promo():
|
||||||
|
now = date.today()
|
||||||
|
return now.month <= 8 and now.year - 1 or now.year
|
||||||
|
|
||||||
|
|
||||||
|
def get_promo_choices():
|
||||||
|
return [("", "Sans promo")] + [(r, r) for r in range(1980, date.today().year + 1)]
|
||||||
|
|
||||||
|
|
||||||
class AccountForm(forms.ModelForm):
|
class AccountForm(forms.ModelForm):
|
||||||
|
promo = forms.TypedChoiceField(
|
||||||
|
choices=get_promo_choices,
|
||||||
|
coerce=int,
|
||||||
|
empty_value=None,
|
||||||
|
initial=default_promo,
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
# Surcharge pour passer data à Account.save()
|
# Surcharge pour passer data à Account.save()
|
||||||
def save(self, data={}, *args, **kwargs):
|
def save(self, data={}, *args, **kwargs):
|
||||||
|
@ -61,7 +117,7 @@ class AccountForm(forms.ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Account
|
model = Account
|
||||||
fields = ["trigramme", "promo", "nickname", "is_frozen"]
|
fields = ["trigramme", "promo", "nickname"]
|
||||||
widgets = {"trigramme": forms.TextInput(attrs={"autocomplete": "off"})}
|
widgets = {"trigramme": forms.TextInput(attrs={"autocomplete": "off"})}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,6 +175,12 @@ class AccountPwdForm(forms.Form):
|
||||||
return self.account
|
return self.account
|
||||||
|
|
||||||
|
|
||||||
|
class AccountFrozenForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Account
|
||||||
|
fields = ["is_frozen"]
|
||||||
|
|
||||||
|
|
||||||
class CofForm(forms.ModelForm):
|
class CofForm(forms.ModelForm):
|
||||||
def clean_is_cof(self):
|
def clean_is_cof(self):
|
||||||
instance = getattr(self, "instance", None)
|
instance = getattr(self, "instance", None)
|
||||||
|
@ -152,17 +214,6 @@ class UserInfoForm(UserForm):
|
||||||
fields = ["first_name", "last_name"]
|
fields = ["first_name", "last_name"]
|
||||||
|
|
||||||
|
|
||||||
class AccountNegativeForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = AccountNegative
|
|
||||||
fields = [
|
|
||||||
"authz_overdraft_amount",
|
|
||||||
"authz_overdraft_until",
|
|
||||||
"comment",
|
|
||||||
]
|
|
||||||
widgets = {"authz_overdraft_until": DateTimeWidget()}
|
|
||||||
|
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Checkout forms
|
# Checkout forms
|
||||||
# -----
|
# -----
|
||||||
|
@ -451,7 +502,6 @@ class AddcostForm(forms.Form):
|
||||||
|
|
||||||
|
|
||||||
class KFetConfigForm(ConfigForm):
|
class KFetConfigForm(ConfigForm):
|
||||||
|
|
||||||
kfet_reduction_cof = forms.DecimalField(
|
kfet_reduction_cof = forms.DecimalField(
|
||||||
label="Réduction COF",
|
label="Réduction COF",
|
||||||
initial=Decimal("20"),
|
initial=Decimal("20"),
|
||||||
|
@ -543,7 +593,7 @@ class TransferForm(forms.ModelForm):
|
||||||
def clean_amount(self):
|
def clean_amount(self):
|
||||||
amount = self.cleaned_data["amount"]
|
amount = self.cleaned_data["amount"]
|
||||||
if amount <= 0:
|
if amount <= 0:
|
||||||
raise forms.ValidationError("Montant invalide")
|
raise forms.ValidationError("Le montant d'un transfert doit être positif")
|
||||||
return amount
|
return amount
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -41,7 +41,6 @@ class Command(BaseCommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.stdout.write("Génération d'opérations")
|
self.stdout.write("Génération d'opérations")
|
||||||
|
|
||||||
# Output log vars
|
# Output log vars
|
||||||
|
@ -74,7 +73,6 @@ class Command(BaseCommand):
|
||||||
opegroup_list = []
|
opegroup_list = []
|
||||||
|
|
||||||
for i in range(num_ops):
|
for i in range(num_ops):
|
||||||
|
|
||||||
# Randomly pick account
|
# Randomly pick account
|
||||||
if random.random() > 0.25:
|
if random.random() > 0.25:
|
||||||
account = random.choice(accounts)
|
account = random.choice(accounts)
|
||||||
|
@ -174,7 +172,6 @@ class Command(BaseCommand):
|
||||||
at_list = []
|
at_list = []
|
||||||
|
|
||||||
for i in range(num_transfers):
|
for i in range(num_transfers):
|
||||||
|
|
||||||
# Randomly pick time
|
# Randomly pick time
|
||||||
at = now - timedelta(seconds=random.randint(0, time))
|
at = now - timedelta(seconds=random.randint(0, time))
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Command(MyBaseCommand):
|
||||||
created_accounts = 0
|
created_accounts = 0
|
||||||
team_accounts = 0
|
team_accounts = 0
|
||||||
|
|
||||||
for (profile, trigramme) in zip(gaulois, gaulois_trigramme):
|
for profile, trigramme in zip(gaulois, gaulois_trigramme):
|
||||||
account, created = Account.objects.get_or_create(
|
account, created = Account.objects.get_or_create(
|
||||||
trigramme=trigramme,
|
trigramme=trigramme,
|
||||||
cofprofile=profile,
|
cofprofile=profile,
|
||||||
|
@ -74,7 +74,7 @@ class Command(MyBaseCommand):
|
||||||
if profile.user.first_name == "Abraracourcix":
|
if profile.user.first_name == "Abraracourcix":
|
||||||
profile.user.groups.add(group_chef)
|
profile.user.groups.add(group_chef)
|
||||||
|
|
||||||
for (profile, trigramme) in zip(romains, romains_trigramme):
|
for profile, trigramme in zip(romains, romains_trigramme):
|
||||||
account, created = Account.objects.get_or_create(
|
account, created = Account.objects.get_or_create(
|
||||||
trigramme=trigramme,
|
trigramme=trigramme,
|
||||||
cofprofile=profile,
|
cofprofile=profile,
|
||||||
|
|
57
kfet/management/commands/sendrappelsnegatifs.py
Normal file
57
kfet/management/commands/sendrappelsnegatifs.py
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
"""
|
||||||
|
Gestion en ligne de commande des mails de rappel K-Fet.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import smtplib
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from kfet.models import AccountNegative
|
||||||
|
|
||||||
|
|
||||||
|
def send_mail(neg: AccountNegative, stdout) -> None:
|
||||||
|
try:
|
||||||
|
neg.send_rappel()
|
||||||
|
stdout.write(f"Mail de rappel pour {neg.account} envoyé avec succès.")
|
||||||
|
except smtplib.SMTPException:
|
||||||
|
stdout.write(f"Erreur lors de l'envoi du mail de rappel pour {neg.account}.")
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = (
|
||||||
|
"Envoie un mail de rappel aux personnes en négatif.\n"
|
||||||
|
"Envoie un mail au bout de 24h, puis un mail par semaine."
|
||||||
|
)
|
||||||
|
leave_locale_alone = True
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
now = timezone.now()
|
||||||
|
|
||||||
|
# Le premier mail est envoyé après 24h de négatif, puis toutes les semaines
|
||||||
|
first_delay = timedelta(days=1)
|
||||||
|
periodic_delay = timedelta(weeks=1)
|
||||||
|
|
||||||
|
# On n'envoie des mails qu'aux comptes qui ont un négatif vraiment actif
|
||||||
|
# et dont la balance est négative
|
||||||
|
# On ignore les comptes gelés qui signinfient une adresse mail plus valide
|
||||||
|
account_negatives = AccountNegative.objects.filter(
|
||||||
|
account__balance__lt=0, account__is_frozen=False
|
||||||
|
).exclude(end__lte=now)
|
||||||
|
|
||||||
|
accounts_first_mail = account_negatives.filter(
|
||||||
|
start__lt=now - first_delay, last_rappel__isnull=True
|
||||||
|
)
|
||||||
|
accounts_periodic_mail = account_negatives.filter(
|
||||||
|
last_rappel__lt=now - periodic_delay
|
||||||
|
)
|
||||||
|
|
||||||
|
for neg in accounts_first_mail:
|
||||||
|
send_mail(neg, self.stdout)
|
||||||
|
|
||||||
|
for neg in accounts_periodic_mail:
|
||||||
|
send_mail(neg, self.stdout)
|
||||||
|
|
||||||
|
if not (accounts_first_mail.exists() or accounts_periodic_mail.exists()):
|
||||||
|
self.stdout.write("Aucun mail à envoyer.")
|
|
@ -9,7 +9,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("gestioncof", "0007_alter_club")]
|
dependencies = [("gestioncof", "0007_alter_club")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("kfet", "0001_initial")]
|
dependencies = [("kfet", "0001_initial")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("kfet", "0002_auto_20160802_2139")]
|
dependencies = [("kfet", "0002_auto_20160802_2139")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("kfet", "0003_auto_20160802_2142")]
|
dependencies = [("kfet", "0003_auto_20160802_2142")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [("kfet", "0004_auto_20160802_2144")]
|
dependencies = [("kfet", "0004_auto_20160802_2144")]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue