fix: shortcut SubscriptionNewUserForm.clean if there are errors

This commit is contained in:
imperosol
2026-05-08 13:50:36 +02:00
parent 7bd2f1da96
commit 94cda48508
3 changed files with 14 additions and 11 deletions
+6
View File
@@ -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",