From 3784e97d60a945f11d920c52afbe8483495ea62a Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 10 Aug 2020 20:09:49 +0200 Subject: [PATCH] Hide the credit interface when editing a WEI registration --- apps/wei/forms/registration.py | 3 +- .../templates/wei/weiregistration_form.html | 42 ++++++++++--------- apps/wei/views.py | 5 +++ 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/apps/wei/forms/registration.py b/apps/wei/forms/registration.py index a2118e34..0e00705a 100644 --- a/apps/wei/forms/registration.py +++ b/apps/wei/forms/registration.py @@ -129,7 +129,8 @@ class WEIMembershipForm(forms.ModelForm): attrs={ 'api_url': '/api/wei/team/', 'placeholder': 'Équipe ...', - } + }, + resetable=True, ), } diff --git a/apps/wei/templates/wei/weiregistration_form.html b/apps/wei/templates/wei/weiregistration_form.html index 9cf507c8..06a14be5 100644 --- a/apps/wei/templates/wei/weiregistration_form.html +++ b/apps/wei/templates/wei/weiregistration_form.html @@ -16,27 +16,29 @@ {% endblock %} {% block extrajavascript %} - + refreshTeams(); + }); + + {% endif %} {% endblock %} diff --git a/apps/wei/views.py b/apps/wei/views.py index b8dd8fa2..27a6efe7 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -607,6 +607,11 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update if not PermissionBackend.check_perm( self.request.user, "wei.change_membership_" + field_name, self.object.membership): field.widget = HiddenInput() + del membership_form.fields["credit_type"] + del membership_form.fields["credit_amount"] + del membership_form.fields["first_name"] + del membership_form.fields["last_name"] + del membership_form.fields["bank"] context["membership_form"] = membership_form elif not self.object.first_year and PermissionBackend.check_perm( self.request.user, "wei.change_weiregistration_information_json", self.object):