#20348: Consistently handle `Promise` objects assigned to model fields.
----------------------------------------------+--------------------
     Reporter:  mrmachine                     |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  master
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 Currently, all `Promise` objects are passed to `force_text()` deep in ORM
 query code. Not only does this make it difficult or impossible for
 developers to prevent or alter this behaviour, but it is also wrong for
 non-text fields.

 `Field.get_prep_value()` seems like a better place to handle `Promise`
 objects, and `_proxy____cast()` seems like a better way to do it than
 passing them through `force_text()`. All `Field` subclasses should call
 `get_prep_value()` on their super class to ensure they have a real value
 to work with.

 This change would also facilitate the creation of custom fields like
 `PickleField`, which *can* store `Promise` objects, to override this
 behaviour.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20348>
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to