I have a FloatField in my models. The increase and decrease buttons on the right side of this area normally increase or decrease by 1 each. Is it possible to do this 1000 by 1000? How can I do that?
models.py
class Customer(models.Model):
...
credit_limit = models.FloatField(default=0, null=True)
...
forms.py
class NewCustomerForm(forms.ModelForm):
class Meta:
model = Customer
fields = ('customer_name', 'country', 'address', 'customer_number', 'phone_number', 'email_address',
'credit_limit', 'currency_choice')
to be clear:

You can make use of the step="…" attribute [w3schools] of the <input type="number"> field, so with:
class NewCustomerForm(forms.ModelForm):
class Meta:
model = Customer
fields = …
widgets = {
'credit_limit': forms.NumberInput(attrs={'step': 1000})
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With