#14158: SelectMultiple _has_changed assumes data and inital are in same order
----------------------+-----------------------------------------------------
Reporter: akaariai | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 1 |
----------------------+-----------------------------------------------------
The _has_changed method assumes data and initial are in same order:
{{{
for value1, value2 in zip(initial, data):
if force_unicode(value1) != force_unicode(value2):
return True
}}}
This seems like a dangerous assumption, because initial and data might
come from different sources. For example if you override the queryset for
ModelMultipleChoiceField to have custom ordering, initial and data
returned from the HTML form will probably differ in order. And by default
m2m initial data in model forms is retrieved without any ordering, so it
is just assumed that every time the query is run, the data will be
retrieved in the same order. This is of course wrong.
--
Ticket URL: <http://code.djangoproject.com/ticket/14158>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.