mirror of
https://github.com/ae-utbm/sith.git
synced 2026-05-13 20:48:06 +00:00
fix: shortcut SubscriptionNewUserForm.clean if there are errors
This commit is contained in:
@@ -120,6 +120,12 @@ class SubscriptionNewUserForm(SubscriptionForm):
|
||||
email=self.cleaned_data.get("email"),
|
||||
date_of_birth=self.cleaned_data.get("date_of_birth"),
|
||||
)
|
||||
if self.errors:
|
||||
# don't bother generating username, password and other data.
|
||||
# The form validation failed anyway, so using a dummy User
|
||||
# (just for Subscription.clean not to crash) is enough
|
||||
self.instance.member = member
|
||||
return super().clean()
|
||||
if self.cleaned_data.get("subscription_type") in [
|
||||
"un-semestre",
|
||||
"deux-semestres",
|
||||
|
||||
Reference in New Issue
Block a user