Django crispy form how to format while typing

20 views Asked by At
super_amount = models.DecimalField(
        max_digits=20,
        decimal_places=2,
        default=Decimal(0),
    )

{{ form.super_amount|as_crispy_field }} I have this field in my form but I want this field to be formatted with commas while typing in browser. So if I write 123456789, it will be shown like this everytime I write a number: 1 -> 12 -> 123 -> 1,234 -> 12,345 -> ... -> 123,456,789

https://stackoverflow.com/a/39279790/14253522

I tried to use this but after 6 digit, field clears itself. I tried to work around this problem but wasn't able to solve it.

0

There are 0 answers