#24858: Add support for get_foo_display() with ArrayField
----------------------------------+------------------------------------
     Reporter:  MounirMesselmeni  |                    Owner:
         Type:  New feature       |                   Status:  new
    Component:  contrib.postgres  |                  Version:  master
     Severity:  Normal            |               Resolution:
     Keywords:                    |             Triage Stage:  Accepted
    Has patch:  1                 |      Needs documentation:  0
  Needs tests:  1                 |  Patch needs improvement:  0
Easy pickings:  1                 |                    UI/UX:  0
----------------------------------+------------------------------------
Changes (by chedi):

 * cc: chedi (added)
 * has_patch:  0 => 1
 * needs_tests:  0 => 1
 * easy:  0 => 1


Comment:

 There is two problems here, the first has to do with the fact that lists
 are not hashable, so get_multi_choices_array_display
 will fail when trying to hash the python object. The second one is more or
 less the same thing but has to do with the
 elements of the choice object, it to has to have the choice element of the
 tuple hashable.

 A quick workaround would be to pass tuples in both instances would be to
 test if the object is an instance of collections.Hashable and call a field
 specific function to convert the value if it's not the case.

 I hacked a some simple code to show the idea, and it seems to work ok.

--
Ticket URL: <https://code.djangoproject.com/ticket/24858#comment:5>
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/074.b7f041b6b719ae7d415c55341fb15ffe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to