#36673: DecimalField max_digits and decimal_places should be optional and more
general
----------------------------+-----------------------------------------
     Reporter:  Gavin Wahl  |                     Type:  Uncategorized
       Status:  new         |                Component:  Uncategorized
      Version:  5.2         |                 Severity:  Normal
     Keywords:              |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+-----------------------------------------
 In Postgres and the SQL standard, it is not necessary to define a
 precision and scale for NUMERIC/DECIMAL fields. However, Django requires
 that they be specified.

 https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-
 NUMERIC-DECIMAL

 I would like to be able to create an unconstrained NUMERIC field with
 `DecimalField()`, but Django gives the error:

 {{{
 (fields.E130) DecimalFields must define a 'decimal_places' attribute.
 fields.E132) DecimalFields must define a 'max_digits' attribute.
 }}}

 Also, the precision needs to be allowed to be less than the scale.
 `NUMERIC(1,2)` is a valid type that stores numbers of the form `-0.00,
 -0.01,...0.08, 0.09` but Django says:

 {{{
 (fields.E134) 'max_digits' must be greater or equal to 'decimal_places'.
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36673>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019a0290774e-ae4205c6-b898-4d11-bcb0-84223dae435f-000000%40eu-central-1.amazonses.com.

Reply via email to