#32593: Cast() to DecimalField() raises DataError.
------------------------------------+--------------------------------------
     Reporter:  Charles Cunningham  |                    Owner:  nobody
         Type:  Bug                 |                   Status:  closed
    Component:  Migrations          |                  Version:  3.2
     Severity:  Normal              |               Resolution:  invalid
     Keywords:                      |             Triage Stage:  Unreviewed
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+--------------------------------------

Comment (by Charles Cunningham):

 Replying to [comment:1 Mariusz Felisiak]:
 > You cannot `Cast()` to `DecimalField`, or use it in `output_field`,
 without providing `decimal_places` and `max_digits` arguments, e.g.
 `DecimalField(decimal_places=2, max_digits=10)` works for me. Also, as far
 as I'm aware there is no need to use `Cast()` in your case:
 > {{{
 >     ...
 >     then=F("registration_volume") / F("capacity"),
 >     ...
 > }}}

 Wouldn't that result in integer division? Or if the output_field is
 DecimalField, will it do decimal division?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32593#comment:3>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.241abc89c9aacafa4938e5648abbcf35%40djangoproject.com.

Reply via email to