#35982: DecimalField.get_db_prep_value() doesn't call adapt_decimalfield_value()
-------------------------------------+-------------------------------------
               Reporter:  Tim        |          Owner:  Tim Graham
  Graham                             |
                   Type:  Bug        |         Status:  assigned
              Component:  Database   |        Version:  5.1
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Some built-in fields have corresponding
 `DatabaseOperations.adapt_<field_name>_value()` methods. For all of these
 fields except `DecimalField`, `get_db_prep_value()` calls the
 corresponding "adapt" method.

 `DecimalField`, however, was changed in
 e9814029f570bd0866dc859147bca90340bcc913 to call
 `adapt_decimalfield_value()` in `get_db_prep_save()`. This causes decimal
 values not to be converted when needed for query lookups (see
 [https://github.com/mongodb-labs/django-
 
mongodb/blob/36c57187de430ab4313e8db5c3ce8ab2ab569f5b/django_mongodb/operations.py#L182-L202
 hacky workaround in django-mongodb)].

 The issue also manifested when adapting `ArrayField` for MongoDB. The lack
 of a proper `DecimalField.get_db_prep_value()` means
 
[https://github.com/django/django/blob/c075d4c2c8cef3c9b28180c749d421c63544a9dd/django/contrib/postgres/fields/array.py#L126-L132
 Decimals aren't prepared properly].
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35982>
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/010701939ec9ee49-f9383995-3627-4384-8570-8ed3cd7eecc0-000000%40eu-central-1.amazonses.com.

Reply via email to