Compare commits
40 commits
master
...
thubrecht/
Author | SHA1 | Date | |
---|---|---|---|
|
b4669847de | ||
|
157165a7c9 | ||
|
7968a70236 | ||
|
74241e22cc | ||
|
192b9d1e15 | ||
|
e2d7bba816 | ||
|
d756cb1f5b | ||
|
ef68e469b5 | ||
|
2b2fcb8d52 | ||
|
0b03a42acc | ||
|
75bf5c9b7d | ||
|
e51951b1f2 | ||
|
29726486e0 | ||
|
6be970b230 | ||
|
1e5d30737f | ||
|
8d655f8b2f | ||
|
14eb740179 | ||
|
48dd2571bc | ||
|
16f500838f | ||
|
67e921a497 | ||
|
9e1e13d360 | ||
|
aeb90f729b | ||
|
6e4895fb16 | ||
|
b512ba2d58 | ||
|
8a1c39e43b | ||
|
95e658d05b | ||
|
9a7deb5e2a | ||
|
c9158c8e13 | ||
|
5a28aab7cb | ||
|
2b712dd05d | ||
|
1ae5c80f76 | ||
|
a01e11e45b | ||
|
3411bc8a00 | ||
|
65ea5d21b2 | ||
|
6db3ed604b | ||
|
d120a2bb62 | ||
|
e1d942a7ca | ||
|
654848c4f0 | ||
|
f026e0b5e3 | ||
|
965ba074b6 |
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,7 +5,6 @@ cof/settings.py
|
|||
settings.py
|
||||
*~
|
||||
venv/
|
||||
.venv/
|
||||
.vagrant
|
||||
/src
|
||||
media/
|
||||
|
@ -20,4 +19,4 @@ media/
|
|||
|
||||
# VSCode
|
||||
.vscode/
|
||||
.direnv
|
||||
.direnv
|
|
@ -43,13 +43,21 @@ variables:
|
|||
# Keep this disabled for now, as it may kill GitLab...
|
||||
# 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:
|
||||
stage: test
|
||||
extends: .test_template
|
||||
variables:
|
||||
DJANGO_SETTINGS_MODULE: "gestioasso.settings.cof_prod"
|
||||
script:
|
||||
- coverage run manage.py test gestioncof bda kfet petitscours shared --parallel
|
||||
- coverage run manage.py test gestioncof bda petitscours shared --parallel
|
||||
|
||||
bdstest:
|
||||
stage: test
|
||||
|
|
39
CHANGELOG.md
39
CHANGELOG.md
|
@ -23,48 +23,19 @@ adhérents ni des cotisations.
|
|||
|
||||
## 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
|
||||
|
|
|
@ -211,6 +211,7 @@ class AttributionAdminForm(forms.ModelForm):
|
|||
|
||||
|
||||
class AttributionAdmin(ReadOnlyMixin, admin.ModelAdmin):
|
||||
|
||||
list_display = ("id", "spectacle", "participant", "given", "paid")
|
||||
search_fields = (
|
||||
"spectacle__title",
|
||||
|
|
|
@ -2,6 +2,7 @@ import random
|
|||
|
||||
|
||||
class Algorithm(object):
|
||||
|
||||
shows = None
|
||||
ranks = None
|
||||
origranks = None
|
||||
|
|
|
@ -81,7 +81,7 @@ class Command(MyBaseCommand):
|
|||
shows = random.sample(
|
||||
list(tirage.spectacle_set.all()), tirage.spectacle_set.count() // 2
|
||||
)
|
||||
for rank, show in enumerate(shows):
|
||||
for (rank, show) in enumerate(shows):
|
||||
choices.append(
|
||||
ChoixSpectacle(
|
||||
participant=part,
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -35,6 +35,7 @@ def fill_tirage_fields(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0001_initial")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0002_add_tirage")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0003_update_tirage_and_spectacle")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0004_mails-rappel")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -18,6 +18,7 @@ def forwards_func(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0005_encoding")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0006_add_tirage_switch")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0007_extends_spectacle")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0008_py3")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -21,6 +21,7 @@ def forwards_func(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0009_revente")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0010_spectaclerevente_shotgun")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -13,6 +13,7 @@ def swap_double_choice(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0011_tirage_appear_catalogue")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0012_notif_time"), ("bda", "0012_swap_double_choice")]
|
||||
|
||||
operations = []
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0013_merge_20180524_2123")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -29,6 +29,7 @@ def set_participant_payment(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0014_attribution_paid_field")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0015_move_bda_payment")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bda", "0016_delete_participant_paid")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("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:
|
||||
ordering = ("priority",)
|
||||
unique_together = (("participant", "spectacle"),)
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["participant", "spectacle"], name="unique_participation"
|
||||
)
|
||||
]
|
||||
verbose_name = "voeu"
|
||||
verbose_name_plural = "voeux"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block extra_head %}
|
||||
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>État des inscriptions BdA</h2>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block extra_head %}
|
||||
<script type="text/javascript" src="{% static 'vendor/jquery/jquery-ui.min.js' %}" ></script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>{{ spectacle }}</h2>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
|
||||
{%block realcontent %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>Inscription à une revente</h2>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles%}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>Inscriptions pour BdA-Revente</h2>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block realcontent %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block extra_head %}
|
||||
<link type="text/css" rel="stylesheet" href="{% static "bda/css/bda.css" %}" />
|
||||
|
|
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.views import SpectacleListView
|
||||
from gestioncof.decorators import buro_required
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r"^inscription/(?P<tirage_id>\d+)$",
|
||||
views.inscription,
|
||||
name="bda-tirage-inscription",
|
||||
),
|
||||
url(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"),
|
||||
url(r"^tirage/(?P<tirage_id>\d+)$", views.tirage, name="bda-tirage"),
|
||||
url(
|
||||
re_path(r"^places/(?P<tirage_id>\d+)$", views.places, name="bda-places-attribuees"),
|
||||
re_path(
|
||||
r"^etat-places/(?P<tirage_id>\d+)$", views.etat_places, name="bda-etat-places"
|
||||
),
|
||||
re_path(r"^tirage/(?P<tirage_id>\d+)$", views.tirage, name="bda-tirage"),
|
||||
re_path(
|
||||
r"^spectacles/(?P<tirage_id>\d+)$",
|
||||
buro_required(SpectacleListView.as_view()),
|
||||
name="bda-liste-spectacles",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^spectacles/(?P<tirage_id>\d+)/(?P<spectacle_id>\d+)$",
|
||||
views.spectacle,
|
||||
name="bda-spectacle",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^spectacles/unpaid/(?P<tirage_id>\d+)$",
|
||||
views.UnpaidParticipants.as_view(),
|
||||
name="bda-unpaid",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^spectacles/autocomplete$",
|
||||
views.spectacle_autocomplete,
|
||||
name="bda-spectacle-autocomplete",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^participants/autocomplete$",
|
||||
views.participant_autocomplete,
|
||||
name="bda-participant-autocomplete",
|
||||
),
|
||||
# Urls BdA-Revente
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<tirage_id>\d+)/manage$",
|
||||
views.revente_manage,
|
||||
name="bda-revente-manage",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<tirage_id>\d+)/subscribe$",
|
||||
views.revente_subscribe,
|
||||
name="bda-revente-subscribe",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<tirage_id>\d+)/tirages$",
|
||||
views.revente_tirages,
|
||||
name="bda-revente-tirages",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<spectacle_id>\d+)/buy$",
|
||||
views.revente_buy,
|
||||
name="bda-revente-buy",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<revente_id>\d+)/confirm$",
|
||||
views.revente_confirm,
|
||||
name="bda-revente-confirm",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^revente/(?P<tirage_id>\d+)/shotgun$",
|
||||
views.revente_shotgun,
|
||||
name="bda-revente-shotgun",
|
||||
),
|
||||
url(r"^mails-rappel/(?P<spectacle_id>\d+)$", views.send_rappel, name="bda-rappels"),
|
||||
url(r"^catalogue/(?P<request_type>[a-z]+)$", views.catalogue, name="bda-catalogue"),
|
||||
re_path(
|
||||
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)
|
||||
|
||||
# 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_losers"] += len(losers)
|
||||
|
||||
# On calcule le déficit et les bénéfices pour le BdA
|
||||
# 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
|
||||
data["total_sold"] += show.slots * show.price
|
||||
if deficit >= 0:
|
||||
|
@ -293,8 +293,8 @@ def do_tirage(tirage_elt, token):
|
|||
# so assign a single object for each Participant id
|
||||
members_uniq = {}
|
||||
members2 = {}
|
||||
for show, members, _ in results:
|
||||
for member, _, _, _ in members:
|
||||
for (show, members, _) in results:
|
||||
for (member, _, _, _) in members:
|
||||
if member.id not in members_uniq:
|
||||
members_uniq[member.id] = 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
|
||||
from django.apps import AppConfig, apps as global_apps
|
||||
from django.db.models import Q
|
||||
from django.db.models.signals import post_migrate
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import bds.models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||
|
|
|
@ -9,6 +9,7 @@ def create_bds_buro_group(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("bds", "0001_initial")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bds", "0002_bds_group"),
|
||||
]
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bds", "0003_staff_permission"),
|
||||
]
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bds", "0004_is_member_cotiz_type"),
|
||||
]
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bds", "0005_remove_bdsprofile_certificate_file"),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{% load bulma_utils %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from datetime import date
|
||||
from unittest import mock
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -6,6 +7,8 @@ from django.contrib.auth.models import Permission
|
|||
from django.test import Client, TestCase
|
||||
from django.urls import reverse, reverse_lazy
|
||||
|
||||
from bds.models import BDSProfile
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
|
@ -24,19 +27,19 @@ def login_url(next=None):
|
|||
|
||||
class TestHomeView(TestCase):
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_get(self, mock_messages):
|
||||
def test_get(self, _):
|
||||
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.assertEquals(resp.status_code, 200)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
|
||||
class TestRegistrationView(TestCase):
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_get_autocomplete(self, mock_messages):
|
||||
def test_get_autocomplete(self, _):
|
||||
user = User.objects.create_user(username="toto")
|
||||
url = reverse("bds:autocomplete") + "?q=foo"
|
||||
client = Client()
|
||||
|
@ -48,15 +51,15 @@ class TestRegistrationView(TestCase):
|
|||
# Logged-in but unprivileged GET
|
||||
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||
resp = client.get(url)
|
||||
self.assertEquals(resp.status_code, 403)
|
||||
self.assertEqual(resp.status_code, 403)
|
||||
|
||||
# Burô user GET
|
||||
give_bds_buro_permissions(user)
|
||||
resp = client.get(url)
|
||||
self.assertEquals(resp.status_code, 200)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_get(self, mock_messages):
|
||||
def test_get(self, _):
|
||||
user = User.objects.create_user(username="toto")
|
||||
url = reverse("bds:user.update", args=(user.id,))
|
||||
client = Client()
|
||||
|
@ -65,6 +68,66 @@ class TestRegistrationView(TestCase):
|
|||
resp = client.get(url)
|
||||
self.assertRedirects(resp, login_url(next=url))
|
||||
|
||||
# Logged-in but unprivileged GET
|
||||
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||
resp = client.get(url)
|
||||
self.assertEqual(resp.status_code, 403)
|
||||
|
||||
# Burô user GET
|
||||
give_bds_buro_permissions(user)
|
||||
resp = client.get(url)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
|
||||
class TestResetMemberships(TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.admin = User.objects.create_user(username="bds_admin")
|
||||
|
||||
# Create users and profiles
|
||||
cls.u_1 = User.objects.create_user(username="bds-01")
|
||||
cls.p_1 = BDSProfile.objects.create(user=cls.u_1)
|
||||
|
||||
cls.u_2 = User.objects.create_user(username="bds-02")
|
||||
cls.p_2 = BDSProfile.objects.create(user=cls.u_2)
|
||||
|
||||
cls.u_3 = User.objects.create_user(username="bds-03")
|
||||
cls.p_3 = BDSProfile.objects.create(user=cls.u_3)
|
||||
|
||||
cls.u_4 = User.objects.create_user(username="bds-04")
|
||||
cls.p_4 = BDSProfile.objects.create(user=cls.u_4)
|
||||
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def setUp(self, _):
|
||||
give_bds_buro_permissions(self.admin)
|
||||
# bds-01 est membre à l'année
|
||||
self.p_1.is_member = True
|
||||
self.p_1.mails_bds = True
|
||||
self.p_1.cotisation_period = "ANN"
|
||||
self.p_1.save()
|
||||
|
||||
# bds-02 est membre au S1
|
||||
self.p_2.is_member = True
|
||||
self.p_2.mails_bds = True
|
||||
self.p_2.cotisation_period = "SE1"
|
||||
self.p_2.save()
|
||||
|
||||
# bds-03 est membre au S2
|
||||
self.p_3.is_member = True
|
||||
self.p_3.mails_bds = True
|
||||
self.p_3.cotisation_period = "SE2"
|
||||
self.p_3.save()
|
||||
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_get_expired(self, _):
|
||||
user = User.objects.create_user(username="toto")
|
||||
url = reverse("bds:members.expired")
|
||||
client = Client()
|
||||
|
||||
# Anonymous GET
|
||||
resp = client.get(url)
|
||||
self.assertRedirects(resp, login_url(next=url))
|
||||
|
||||
# Logged-in but unprivileged GET
|
||||
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||
resp = client.get(url)
|
||||
|
@ -74,3 +137,114 @@ class TestRegistrationView(TestCase):
|
|||
give_bds_buro_permissions(user)
|
||||
resp = client.get(url)
|
||||
self.assertEquals(resp.status_code, 200)
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
resp.context_data["object_list"], BDSProfile.expired_members()
|
||||
)
|
||||
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_get_reset(self, _):
|
||||
user = User.objects.create_user(username="tata")
|
||||
url = reverse("bds:members.reset")
|
||||
client = Client()
|
||||
|
||||
# Anonymous GET
|
||||
resp = client.get(url)
|
||||
self.assertRedirects(resp, login_url(next=url))
|
||||
|
||||
# Logged-in but unprivileged GET
|
||||
client.force_login(user, backend="django.contrib.auth.backends.ModelBackend")
|
||||
resp = client.get(url)
|
||||
self.assertEquals(resp.status_code, 403)
|
||||
|
||||
# Burô user GET
|
||||
give_bds_buro_permissions(user)
|
||||
resp = client.get(url)
|
||||
self.assertRedirects(resp, reverse("bds:members.expired"))
|
||||
|
||||
def test_expired_memberships(self):
|
||||
# In september, there is no expired members
|
||||
with mock.patch("bds.models.timezone.now", return_value=date(2022, 9, 1)):
|
||||
self.assertQuerysetEqual(BDSProfile.expired_members(), [])
|
||||
|
||||
# In march, only bds-02's membership is expired
|
||||
with mock.patch("django.utils.timezone.now", return_value=date(2023, 3, 1)):
|
||||
self.assertQuerysetEqual(BDSProfile.expired_members(), [self.p_2])
|
||||
|
||||
# During summer, all memberships are expired
|
||||
with mock.patch("django.utils.timezone.now", return_value=date(2023, 7, 1)):
|
||||
self.assertQuerysetEqual(
|
||||
BDSProfile.expired_members(),
|
||||
[self.p_1, self.p_2, self.p_3],
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
@mock.patch("gestioncof.signals.messages")
|
||||
def test_reset_memberships(self, _):
|
||||
url = reverse("bds:members.reset")
|
||||
|
||||
# Reset during S1 does nothig
|
||||
with mock.patch("bds.models.timezone.now", return_value=date(2022, 9, 1)):
|
||||
self.client.force_login(
|
||||
self.admin, backend="django.contrib.auth.backends.ModelBackend"
|
||||
)
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertRedirects(resp, reverse("bds:members.expired"))
|
||||
|
||||
self.assertQuerysetEqual(BDSProfile.expired_members(), [])
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
BDSProfile.objects.filter(is_member=True),
|
||||
[self.p_1, self.p_2, self.p_3],
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
# Reset in march
|
||||
with mock.patch("django.utils.timezone.now", return_value=date(2023, 3, 1)):
|
||||
self.client.force_login(
|
||||
self.admin, backend="django.contrib.auth.backends.ModelBackend"
|
||||
)
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertRedirects(resp, reverse("bds:members.expired"))
|
||||
|
||||
# After a reset we have no expired memberships
|
||||
self.assertQuerysetEqual(BDSProfile.expired_members(), [])
|
||||
|
||||
# Test reset attributes
|
||||
self.p_2.refresh_from_db()
|
||||
self.assertEqual(
|
||||
[self.p_2.is_member, self.p_2.mails_bds, self.p_2.cotisation_period],
|
||||
[False, False, "NO"],
|
||||
)
|
||||
|
||||
# Reset during summer
|
||||
with mock.patch("django.utils.timezone.now", return_value=date(2023, 7, 1)):
|
||||
# bds-02's membership wa already reset
|
||||
self.assertQuerysetEqual(
|
||||
BDSProfile.expired_members(), [self.p_1, self.p_3], ordered=False
|
||||
)
|
||||
|
||||
self.client.force_login(
|
||||
self.admin, backend="django.contrib.auth.backends.ModelBackend"
|
||||
)
|
||||
resp = self.client.get(url)
|
||||
|
||||
self.assertRedirects(resp, reverse("bds:members.expired"))
|
||||
|
||||
# After a reset we have no expired memberships
|
||||
self.assertQuerysetEqual(BDSProfile.expired_members(), [])
|
||||
|
||||
# Test reset attributes
|
||||
self.p_1.refresh_from_db()
|
||||
self.assertEqual(
|
||||
[self.p_1.is_member, self.p_1.mails_bds, self.p_1.cotisation_period],
|
||||
[False, False, "NO"],
|
||||
)
|
||||
|
||||
self.p_3.refresh_from_db()
|
||||
self.assertEqual(
|
||||
[self.p_3.is_member, self.p_3.mails_bds, self.p_3.cotisation_period],
|
||||
[False, False, "NO"],
|
||||
)
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("events", "0001_event"),
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("events", "0002_event_subscribers"),
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("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)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["event", "name"], name="unique_event_option"
|
||||
)
|
||||
]
|
||||
verbose_name = _("option d'événement")
|
||||
verbose_name_plural = _("options d'événement")
|
||||
unique_together = [["event", "name"]]
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -87,9 +91,13 @@ class OptionChoice(models.Model):
|
|||
choice = models.CharField(_("choix"), max_length=200)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["option", "choice"], name="unique_option_choice"
|
||||
)
|
||||
]
|
||||
verbose_name = _("choix d'option d'événement")
|
||||
verbose_name_plural = _("choix d'option d'événement")
|
||||
unique_together = [["option", "choice"]]
|
||||
|
||||
def __str__(self):
|
||||
return self.choice
|
||||
|
@ -118,7 +126,9 @@ class ExtraField(models.Model):
|
|||
field_type = models.CharField(_("type de champ"), max_length=9, choices=FIELD_TYPE)
|
||||
|
||||
class Meta:
|
||||
unique_together = [["event", "name"]]
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=["event", "name"], name="unique_extra_field")
|
||||
]
|
||||
|
||||
|
||||
class ExtraFieldContent(models.Model):
|
||||
|
@ -137,9 +147,13 @@ class ExtraFieldContent(models.Model):
|
|||
)
|
||||
|
||||
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_plural = _("contenus d'un champ événement supplémentaire")
|
||||
unique_together = [["field", "registration"]]
|
||||
|
||||
def __str__(self):
|
||||
max_length = 50
|
||||
|
@ -163,9 +177,13 @@ class Registration(models.Model):
|
|||
)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["event", "user"], name="unique_registration"
|
||||
)
|
||||
]
|
||||
verbose_name = _("inscription à un événement")
|
||||
verbose_name_plural = _("inscriptions à un événement")
|
||||
unique_together = [["event", "user"]]
|
||||
|
||||
def __str__(self):
|
||||
return "inscription de {} à {}".format(self.user, self.event)
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
"""
|
||||
ASGI entrypoint. Configures Django and then runs the application
|
||||
defined in the ASGI_APPLICATION setting.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from channels.asgi import get_channel_layer
|
||||
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")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gestioasso.settings.local")
|
||||
|
||||
channel_layer = get_channel_layer()
|
||||
django.setup()
|
||||
application = get_default_application()
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
from channels.routing import include
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from django.core.asgi import get_asgi_application
|
||||
from django.urls import path
|
||||
|
||||
routing = [include("kfet.routing.routing", path=r"^/ws/k-fet")]
|
||||
from kfet.routing import KFRouter
|
||||
|
||||
application = ProtocolTypeRouter(
|
||||
{
|
||||
# WebSocket chat handler
|
||||
"websocket": AuthMiddlewareStack(
|
||||
URLRouter(
|
||||
[
|
||||
path("ws/k-fet", KFRouter),
|
||||
]
|
||||
)
|
||||
),
|
||||
"http": get_asgi_application(),
|
||||
}
|
||||
)
|
||||
|
|
|
@ -85,7 +85,6 @@ MIDDLEWARE = (
|
|||
+ MIDDLEWARE
|
||||
+ [
|
||||
"djconfig.middleware.DjConfigMiddleware",
|
||||
"wagtail.core.middleware.SiteMiddleware",
|
||||
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
||||
]
|
||||
)
|
||||
|
@ -109,6 +108,8 @@ MEDIA_URL = "/gestion/media/"
|
|||
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
|
||||
# ---
|
||||
|
@ -147,7 +148,7 @@ CACHES = {
|
|||
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "asgi_redis.RedisChannelLayer",
|
||||
"BACKEND": "shared.channels.ChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [
|
||||
(
|
||||
|
@ -160,11 +161,9 @@ CHANNEL_LAYERS = {
|
|||
)
|
||||
]
|
||||
},
|
||||
"ROUTING": "gestioasso.routing.routing",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ---
|
||||
# reCAPTCHA settings
|
||||
# https://github.com/praekelt/django-recaptcha
|
||||
|
@ -206,9 +205,8 @@ MAIL_DATA = {
|
|||
"REPLYTO": "cof@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>",
|
||||
"rappel_negatif": {
|
||||
"FROM": "La K-Fêt <k-fet@ens.fr>",
|
||||
},
|
||||
"revente": {
|
||||
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
||||
|
|
|
@ -101,7 +101,7 @@ TEMPLATES = [
|
|||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"NAME": DBNAME,
|
||||
"USER": DBUSER,
|
||||
"PASSWORD": DBPASSWD,
|
||||
|
@ -111,6 +111,7 @@ DATABASES = {
|
|||
|
||||
SITE_ID = 1
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||
|
||||
# ---
|
||||
# Internationalization
|
||||
|
|
|
@ -47,8 +47,7 @@ CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"
|
|||
# Use the default in memory asgi backend for local development
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "asgiref.inmemory.ChannelLayer",
|
||||
"ROUTING": "gestioasso.routing.routing",
|
||||
"BACKEND": "channels.layers.InMemoryChannelLayer",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ app_dict = {
|
|||
"events": "gestion/event_v2/", # the events module is still experimental !
|
||||
"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:
|
||||
urlpatterns += [path(url_prefix, include("{}.urls".format(app_name)))]
|
||||
|
||||
|
|
|
@ -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.urls import reverse
|
||||
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 (
|
||||
Club,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
default_app_config = "gestioncof.cms.apps.COFCMSAppConfig"
|
|
@ -13,6 +13,7 @@ import gestioncof.cms.models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("cofcms", "0001_initial")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("cofcms", "0002_auto_20190523_1521"),
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("cofcms", "0003_directory_entry_optional_links"),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@ from datetime import date, timedelta
|
|||
|
||||
from django import template
|
||||
from django.utils import formats, timezone
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from ..models import COFActuPage, COFRootPage
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.contrib.auth import get_user_model
|
|||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.forms.formsets import BaseFormSet, formset_factory
|
||||
from django.forms.widgets import CheckboxSelectMultiple, RadioSelect
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from djconfig.forms import ConfigForm
|
||||
|
||||
from bda.models import Spectacle
|
||||
|
@ -276,7 +276,9 @@ class RegistrationProfileForm(forms.ModelForm):
|
|||
self.fields["mailing_bda_revente"].initial = True
|
||||
self.fields["mailing_unernestaparis"].initial = True
|
||||
|
||||
self.fields.keyOrder = [
|
||||
class Meta:
|
||||
model = CofProfile
|
||||
fields = [
|
||||
"login_clipper",
|
||||
"phone",
|
||||
"occupation",
|
||||
|
@ -290,22 +292,6 @@ class RegistrationProfileForm(forms.ModelForm):
|
|||
"comments",
|
||||
]
|
||||
|
||||
class Meta:
|
||||
model = CofProfile
|
||||
fields = (
|
||||
"login_clipper",
|
||||
"phone",
|
||||
"occupation",
|
||||
"departement",
|
||||
"is_cof",
|
||||
"type_cotiz",
|
||||
"mailing_cof",
|
||||
"mailing_bda",
|
||||
"mailing_bda_revente",
|
||||
"mailing_unernestaparis",
|
||||
"comments",
|
||||
)
|
||||
|
||||
|
||||
STATUS_CHOICES = (
|
||||
("no", "Non"),
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0001_initial")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0002_enable_unprocessed_demandes")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -25,6 +25,7 @@ def create_mail(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0003_event_image")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0004_registration_mail")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bda", "0004_mails-rappel"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0006_add_calendar")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -10,6 +10,7 @@ def forwards(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0007_alter_club")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0008_py3")]
|
||||
|
||||
operations = [migrations.DeleteModel(name="Clipper")]
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0009_delete_clipper")]
|
||||
|
||||
operations = [migrations.DeleteModel(name="CustomMail")]
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0010_delete_custommail")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0010_delete_custommail")]
|
||||
|
||||
operations = [migrations.RemoveField(model_name="cofprofile", name="num")]
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("gestioncof", "0011_remove_cofprofile_num"),
|
||||
("gestioncof", "0011_longer_clippers"),
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0012_merge")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0013_pei")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0014_cofprofile_mailing_unernestaparis")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -16,6 +16,7 @@ def null_clippers_to_empty(apps, schema_editor):
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("gestioncof", "0015_psql_choices_niveaux")]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("gestioncof", "0016_unique_clippers"),
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("gestioncof", "0017_petitscours_uniqueness"),
|
||||
]
|
||||
|
|
43
gestioncof/migrations/0019_auto_20220630_1241.py
Normal file
43
gestioncof/migrations/0019_auto_20220630_1241.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Generated by Django 3.2.13 on 2022-06-30 10:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("gestioncof", "0018_petitscours_email"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name="eventregistration",
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="petitcoursability",
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="surveyanswer",
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="eventregistration",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("user", "event"), name="unique_event_registration"
|
||||
),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="petitcoursability",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("user", "niveau", "matiere"), name="unique_competence_level"
|
||||
),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="surveyanswer",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("user", "survey"), name="unique_survey_answer"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -1,19 +0,0 @@
|
|||
# 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"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -2,7 +2,7 @@ from django.contrib.auth.models import User
|
|||
from django.db import models
|
||||
from django.db.models.signals import post_delete, post_save
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from bda.models import Spectacle
|
||||
from shared.utils import choices_length
|
||||
|
@ -50,7 +50,6 @@ class CofProfile(models.Model):
|
|||
"Login clipper", max_length=32, blank=True, unique=True, null=True
|
||||
)
|
||||
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)
|
||||
occupation = models.CharField(
|
||||
_("Occupation"),
|
||||
|
@ -194,8 +193,12 @@ class EventRegistration(models.Model):
|
|||
paid = models.BooleanField("A payé", default=False)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["user", "event"], name="unique_event_registration"
|
||||
)
|
||||
]
|
||||
verbose_name = "Inscription"
|
||||
unique_together = ("user", "event")
|
||||
|
||||
def __str__(self):
|
||||
return "Inscription de {} à {}".format(self.user, self.event.title)
|
||||
|
@ -247,8 +250,12 @@ class SurveyAnswer(models.Model):
|
|||
answers = models.ManyToManyField(SurveyQuestionAnswer, related_name="selected_by")
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["user", "survey"], name="unique_survey_answer"
|
||||
)
|
||||
]
|
||||
verbose_name = "Réponses"
|
||||
unique_together = ("user", "survey")
|
||||
|
||||
def __str__(self):
|
||||
return "Réponse de %s sondage %s" % (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.contrib import messages
|
||||
from django.contrib.auth.signals import user_logged_in
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_cas_ng.signals import cas_user_authenticated
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base_title.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
|
||||
{% block page_size %}col-sm-8{% endblock %}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script type="text/javascript">
|
||||
var supernifty_tristate = function() {
|
||||
var
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uuid
|
||||
from datetime import date, timedelta
|
||||
from datetime import timedelta
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth import get_user_model
|
||||
|
@ -194,7 +194,9 @@ class RegistrationViewTests(ViewTestCaseMixin, TestCase):
|
|||
)
|
||||
|
||||
er = e.eventregistration_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(er.options.all(), map(repr, [oc1, oc3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [oc1, oc3]), transform=repr, ordered=False
|
||||
)
|
||||
self.assertCountEqual(
|
||||
er.comments.values_list("content", flat=True), ["comment 1"]
|
||||
)
|
||||
|
@ -299,10 +301,10 @@ class RegistrationAutocompleteViewTests(MockLDAPMixin, ViewTestCaseMixin, TestCa
|
|||
raise ValueError("Unexpected section name: {}".format(section.name))
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
others, map(str, expected_others), ordered=False, transform=str
|
||||
others, map(str, expected_others), transform=str, ordered=False
|
||||
)
|
||||
self.assertQuerysetEqual(
|
||||
members, map(str, expected_members), ordered=False, transform=str
|
||||
members, map(str, expected_members), transform=str, ordered=False
|
||||
)
|
||||
self.assertSetEqual(
|
||||
set(clippers), set(map(LDAPSearch().result_verbose_name, expected_clippers))
|
||||
|
@ -484,7 +486,6 @@ class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
|||
u1.last_name = "last"
|
||||
u1.email = "user@mail.net"
|
||||
u1.save()
|
||||
u1.profile.date_adhesion = date(2023, 5, 22)
|
||||
u1.profile.phone = "0123456789"
|
||||
u1.profile.departement = "Dept"
|
||||
u1.profile.save()
|
||||
|
@ -506,9 +507,8 @@ class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
|||
"1A",
|
||||
"Dept",
|
||||
"normalien",
|
||||
"2023-05-22",
|
||||
],
|
||||
[str(u2.pk), "staff", "", "", "", "", "1A", "", "normalien", "None"],
|
||||
[str(u2.pk), "staff", "", "", "", "", "1A", "", "normalien"],
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -550,6 +550,7 @@ class ExportMegaOrgasViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
|||
auth_forbidden = [None, "user", "member"]
|
||||
|
||||
def test(self):
|
||||
|
||||
r = self.client.get(self.url)
|
||||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
@ -648,7 +649,10 @@ class ClubListViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["owned_clubs"], map(repr, [self.c1, self.c2]), ordered=False
|
||||
r.context["owned_clubs"],
|
||||
map(repr, [self.c1, self.c2]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
||||
|
@ -950,7 +954,10 @@ class EventViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
er = self.e.eventregistration_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [self.oc1, self.oc3, self.oc4]), ordered=False
|
||||
er.options.all(),
|
||||
map(repr, [self.oc1, self.oc3, self.oc4]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
# TODO: Make the view care about comments.
|
||||
# self.assertQuerysetEqual(
|
||||
|
@ -975,7 +982,9 @@ class EventViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertIn(self.post_expected_message, get_messages(r.wsgi_request))
|
||||
|
||||
er.refresh_from_db()
|
||||
self.assertQuerysetEqual(er.options.all(), map(repr, [self.oc3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [self.oc3]), transform=repr, ordered=False
|
||||
)
|
||||
# TODO: Make the view care about comments.
|
||||
# self.assertQuerysetEqual(
|
||||
# er.comments.all(), map(repr, []),
|
||||
|
@ -1029,7 +1038,10 @@ class EventStatusViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["user_choices"], map(repr, expected), ordered=False
|
||||
r.context["user_choices"],
|
||||
map(repr, expected),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_filter_none(self):
|
||||
|
@ -1096,7 +1108,10 @@ class SurveyViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
a = self.s.surveyanswer_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(
|
||||
a.answers.all(), map(repr, [self.qa1, self.qa3, self.qa4]), ordered=False
|
||||
a.answers.all(),
|
||||
map(repr, [self.qa1, self.qa3, self.qa4]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_post_edit(self):
|
||||
|
@ -1115,7 +1130,9 @@ class SurveyViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertIn(self.post_expected_message, get_messages(r.wsgi_request))
|
||||
|
||||
a.refresh_from_db()
|
||||
self.assertQuerysetEqual(a.answers.all(), map(repr, [self.qa3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
a.answers.all(), map(repr, [self.qa3]), transform=repr, ordered=False
|
||||
)
|
||||
|
||||
def test_post_delete(self):
|
||||
a = self.s.surveyanswer_set.create(user=self.users["user"])
|
||||
|
@ -1196,7 +1213,10 @@ class SurveyStatusViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["user_answers"], map(repr, expected), ordered=False
|
||||
r.context["user_answers"],
|
||||
map(repr, expected),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_filter_none(self):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import csv
|
||||
import uuid
|
||||
from datetime import date, timedelta
|
||||
from datetime import timedelta
|
||||
from smtplib import SMTPRecipientsRefused
|
||||
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
|
||||
|
||||
|
@ -20,7 +20,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
|||
from django.template import loader
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import FormView, TemplateView
|
||||
from django_cas_ng.views import LogoutView as CasLogoutView
|
||||
from icalendar import Calendar, Event as Vevent
|
||||
|
@ -86,7 +86,6 @@ class ResetComptes(BuroRequiredMixin, TemplateView):
|
|||
nb_adherents = CofProfile.objects.filter(is_cof=True).count()
|
||||
CofProfile.objects.update(
|
||||
is_cof=False,
|
||||
date_adhesion=None,
|
||||
mailing_cof=False,
|
||||
mailing_bda=False,
|
||||
mailing_bda_revente=False,
|
||||
|
@ -576,9 +575,6 @@ def registration(request):
|
|||
profile = profile_form.save()
|
||||
if profile.is_cof and not was_cof:
|
||||
notify_new_member(request, member)
|
||||
profile.date_adhesion = date.today()
|
||||
profile.save()
|
||||
|
||||
# Enregistrement des inscriptions aux événements
|
||||
for form in event_formset:
|
||||
if "status" not in form.cleaned_data:
|
||||
|
@ -719,7 +715,6 @@ def export_members(request):
|
|||
profile.occupation,
|
||||
profile.departement,
|
||||
profile.type_cotiz,
|
||||
profile.date_adhesion,
|
||||
]
|
||||
writer.writerow([str(bit) for bit in bits])
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue