#26189: Models with decimal fields raise errors on calling full_clean
-------------------------------+--------------------
     Reporter:  lenniezelk     |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.9
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 After assigning a value with decimal places to a decimal field in a model
 , calling the model's `full_clean` method raises a `ValidationError`:
 {{{#!python
      ----> 1 transaction.full_clean()

 /home/vagrant/.virtualenvs/cashbox/lib/python3.4/site-
 packages/django/db/models/base.py in full_clean(self, exclude,
 validate_unique)
    1134
    1135         if errors:
 -> 1136             raise ValidationError(errors)
    1137
    1138     def clean_fields(self, exclude=None):

 ValidationError: {'amount': ['Ensure that there are no more than 12 digits
 in total.']}
   }}}

 Seems to be raised by the new Decimal validator. Decimal field's
 `to_python` method creates a Decimal instance that has many decimal places
 which ends up violating the `max_digits` setting on the Decimal field.

--
Ticket URL: <https://code.djangoproject.com/ticket/26189>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.2377f46780b66a5264773f5d957d0289%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to