Add basic roles for BDE and Kfet

This commit is contained in:
Yohann D'ANELLO 2020-04-05 16:05:49 +02:00
parent ff820ef086
commit f2baeedc01
2 changed files with 12 additions and 8 deletions

View File

@ -15,7 +15,7 @@ from django.views.decorators.csrf import csrf_protect
from django.views.generic import CreateView, TemplateView, DetailView, FormView from django.views.generic import CreateView, TemplateView, DetailView, FormView
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from member.forms import ProfileForm 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.models import SpecialTransaction, NoteSpecial
from note.templatetags.pretty_money import pretty_money from note.templatetags.pretty_money import pretty_money
from permission.backends import PermissionBackend from permission.backends import PermissionBackend
@ -262,18 +262,22 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView,
) )
if join_BDE: if join_BDE:
Membership.objects.create( membership = Membership.objects.create(
club=bde, club=bde,
user=user, user=user,
fee=bde_fee, fee=bde_fee,
) )
membership.roles.add(Role.objects.get(name="Adhérent BDE"))
membership.save()
if join_Kfet: if join_Kfet:
Membership.objects.create( membership = Membership.objects.create(
club=kfet, club=kfet,
user=user, user=user,
fee=kfet_fee, fee=kfet_fee,
) )
membership.roles.add(Role.objects.get(name="Adhérent Kfet"))
membership.save()
return ret return ret

View File

@ -1135,12 +1135,12 @@ msgstr "Gérer les jetons d'authentification"
#: templates/member/profile_tables.html:7 #: templates/member/profile_tables.html:7
#: templates/registration/future_profile_detail.html:28 #: templates/registration/future_profile_detail.html:28
msgid "This user doesn't have confirmed his/her e-mail address." 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/member/profile_tables.html:8
#: templates/registration/future_profile_detail.html:29 #: templates/registration/future_profile_detail.html:29
msgid "Click here to resend a validation link." msgid "Click here to resend a validation link."
msgstr "" msgstr "Cliquez ici pour renvoyer un lien de validation."
#: templates/member/profile_tables.html:18 #: templates/member/profile_tables.html:18
msgid "View my memberships" msgid "View my memberships"
@ -1247,15 +1247,15 @@ msgstr ""
#: templates/registration/future_profile_detail.html:56 #: templates/registration/future_profile_detail.html:56
msgid "Delete registration" msgid "Delete registration"
msgstr "" msgstr "Supprimer l'inscription"
#: templates/registration/future_profile_detail.html:64 #: templates/registration/future_profile_detail.html:64
msgid "Validate account" msgid "Validate account"
msgstr "" msgstr "Valider le compte"
#: templates/registration/future_profile_detail.html:71 #: templates/registration/future_profile_detail.html:71
msgid "Validate registration" msgid "Validate registration"
msgstr "" msgstr "Valider l'inscription"
#: templates/registration/future_user_list.html:7 #: templates/registration/future_user_list.html:7
msgid "New user" msgid "New user"