mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 03:02:23 +00:00
Fix add organizer view
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
fc6e2593b4
commit
2a545dae10
@ -92,21 +92,17 @@ class AddOrganizerView(VolunteerMixin, CreateView):
|
||||
|
||||
context["volunteer_registration_form"] = VolunteerRegistrationForm(self.request.POST or None)
|
||||
del context["volunteer_registration_form"].fields["email_confirmed"]
|
||||
if not self.request.user.registration.is_admin:
|
||||
del context["volunteer_registration_form"].fields["admin"]
|
||||
|
||||
return context
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
|
||||
if not self.request.user.registration.is_admin:
|
||||
del form.fields["admin"]
|
||||
|
||||
return form
|
||||
|
||||
@transaction.atomic
|
||||
def form_valid(self, form):
|
||||
registration_form = VolunteerRegistrationForm(self.request.POST)
|
||||
del registration_form.fields["email_confirmed"]
|
||||
if not self.request.user.registration.is_admin:
|
||||
del registration_form.fields["admin"]
|
||||
|
||||
if not registration_form.is_valid():
|
||||
return self.form_invalid(form)
|
||||
|
Loading…
Reference in New Issue
Block a user