Add clean function for variant weight to be zero when form blank
This commit is contained in:
parent
ef3d293d5c
commit
72938dcb58
@ -37,6 +37,13 @@ class ProductVariantUpdateForm(forms.ModelForm):
|
||||
product=self.instance.product
|
||||
)
|
||||
|
||||
def clean_weight(self):
|
||||
data = self.cleaned_data['weight']
|
||||
if not data:
|
||||
data = 0
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class CouponForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user