mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Fix crash during validation
This commit is contained in:
parent
a548f4744e
commit
8ebea00896
@ -64,6 +64,9 @@ class ProductForm(Form):
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
if len(self.errors) > 0:
|
||||
return
|
||||
|
||||
if self.customer is None or self.counter is None:
|
||||
raise RuntimeError(
|
||||
f"{self} has been initialized without customer or counter"
|
||||
@ -114,6 +117,9 @@ class BaseBasketForm(BaseFormSet):
|
||||
super().clean()
|
||||
if len(self) == 0:
|
||||
return
|
||||
if len(self.errors) > 0:
|
||||
return
|
||||
|
||||
self._check_recorded_products(self[0].customer)
|
||||
self._check_enough_money(self[0].counter, self[0].customer)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user