Fix: количество — только целое 0–99 (модели, формы, JS)
Made-with: Cursor
This commit is contained in:
@@ -13,22 +13,32 @@ from django.forms import inlineformset_factory
|
||||
|
||||
|
||||
class CustomerOrderItemForm(forms.ModelForm):
|
||||
quantity = forms.IntegerField(
|
||||
min_value=0,
|
||||
max_value=99,
|
||||
widget=forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "step": 1, "style": "width: 4ch"}),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = CustomerOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"price": forms.TextInput(attrs={"inputmode": "decimal", "class": "ws-price-input"}),
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
|
||||
class SupplierOrderItemForm(forms.ModelForm):
|
||||
quantity = forms.IntegerField(
|
||||
min_value=0,
|
||||
max_value=99,
|
||||
widget=forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "step": 1, "style": "width: 4ch"}),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = SupplierOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"price": forms.TextInput(attrs={"inputmode": "decimal", "class": "ws-price-input"}),
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user