[WEI] Fix error when validating sometimes a membership

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-09 09:27:15 +02:00
parent 2c02c747f4
commit 5793b83de7
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 2 additions and 3 deletions

View File

@ -973,12 +973,11 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
membership.roles.set(WEIRole.objects.filter(name="1A").all()) membership.roles.set(WEIRole.objects.filter(name="1A").all())
membership.save() membership.save()
ret = super().form_valid(form) membership.save()
membership.refresh_from_db() membership.refresh_from_db()
membership.roles.add(WEIRole.objects.get(name="Adhérent WEI")) membership.roles.add(WEIRole.objects.get(name="Adhérent WEI"))
return ret return super().form_valid(form)
def get_success_url(self): def get_success_url(self):
self.object.refresh_from_db() self.object.refresh_from_db()