From f2baeedc013d5c5b1261abbe7fc1632e0730520e Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 5 Apr 2020 16:05:49 +0200 Subject: [PATCH] Add basic roles for BDE and Kfet --- apps/registration/views.py | 10 +++++++--- locale/fr/LC_MESSAGES/django.po | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index 8d303392..9f003dac 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -15,7 +15,7 @@ from django.views.decorators.csrf import csrf_protect from django.views.generic import CreateView, TemplateView, DetailView, FormView from django_tables2 import SingleTableView from member.forms import ProfileForm -from member.models import Membership, Club +from member.models import Membership, Club, Role from note.models import SpecialTransaction, NoteSpecial from note.templatetags.pretty_money import pretty_money from permission.backends import PermissionBackend @@ -262,18 +262,22 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView, ) if join_BDE: - Membership.objects.create( + membership = Membership.objects.create( club=bde, user=user, fee=bde_fee, ) + membership.roles.add(Role.objects.get(name="Adhérent BDE")) + membership.save() if join_Kfet: - Membership.objects.create( + membership = Membership.objects.create( club=kfet, user=user, fee=kfet_fee, ) + membership.roles.add(Role.objects.get(name="Adhérent Kfet")) + membership.save() return ret diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 279a73ff..dca8fd69 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -1135,12 +1135,12 @@ msgstr "Gérer les jetons d'authentification" #: templates/member/profile_tables.html:7 #: templates/registration/future_profile_detail.html:28 msgid "This user doesn't have confirmed his/her e-mail address." -msgstr "" +msgstr "Cet utilisateur n'a pas encore confirmé son adresse e-mail." #: templates/member/profile_tables.html:8 #: templates/registration/future_profile_detail.html:29 msgid "Click here to resend a validation link." -msgstr "" +msgstr "Cliquez ici pour renvoyer un lien de validation." #: templates/member/profile_tables.html:18 msgid "View my memberships" @@ -1247,15 +1247,15 @@ msgstr "" #: templates/registration/future_profile_detail.html:56 msgid "Delete registration" -msgstr "" +msgstr "Supprimer l'inscription" #: templates/registration/future_profile_detail.html:64 msgid "Validate account" -msgstr "" +msgstr "Valider le compte" #: templates/registration/future_profile_detail.html:71 msgid "Validate registration" -msgstr "" +msgstr "Valider l'inscription" #: templates/registration/future_user_list.html:7 msgid "New user"