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