#25953: Add from_db_value() support to 
django.contrib.postgres.fields.ArrayField.
----------------------------------+---------------------------------------
     Reporter:  karanlyons        |      Owner:
         Type:  New feature       |     Status:  new
    Component:  contrib.postgres  |    Version:  1.9
     Severity:  Normal            |   Keywords:  ArrayField, from_db_value
 Triage Stage:  Unreviewed        |  Has patch:  1
Easy pickings:  0                 |      UI/UX:  0
----------------------------------+---------------------------------------
 Currently ArrayField assumes that the base field will not need to alter
 the returned python value from the postgres backend, as this is the case
 for all core fields. As an example, take this absurd field:

 {{{
 class ContrivedStringedIntegerField(models.IntegerField):
         def from_db_value(self, value, expression, connection, context):
                 return unicode(value)
 }}}

 Used alone in a model this will return a string, but used as part of an
 ArrayField we’ll get integers instead.

 from_db_value() is a no-op for performance reasons, so rather than incur
 the penalty inside of ArrayField when it’s unnecessary, I propose the
 attached patch, which adds a from_db_value() method to the instantiated
 ArrayField if its base field has one as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/25953>
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.2b83b04d91f4b156bf5c25f838c93727%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to