Changes between Initial Version and Version 2 of Ticket #24858


Ignore:
Timestamp:
May 27, 2015, 2:19:31 AM (9 years ago)
Author:
Mounir
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24858 – Description

    initial v2  
    22Passing choices to ArrayField works fine with MultipleChoiceField on the form.
    33But calling get_foo_display return a TypeError: unhashable type: 'list', maybe this method need to check if the field is an ArrayField it can return a string representation of the choices separated by comma.
     4
     5
     6{{{#!python
     7class Example(models.Model):
     8    CHOICES = (
     9        (1, 'value1'),
     10        (2, 'value2'),
     11        (3, 'value3'),
     12    )
     13
     14    multi_choices_array = ArrayField(
     15        base_field=models.IntegerField(),
     16        choices=CHOICES,
     17    )
     18
     19    example = Example.objects.create(multi_choices_array= [1, 2])
     20    example.get_multi_choices_array_display()
     21    # Will raise a Type Error exception
     22
     23}}}
Back to Top