applegrew / django-select2

This is a Django integration for Select2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultipleSelect2HiddenInput returns bad has_changed value

mociepka opened this issue · comments

MultipleSelect2HiddenInput extends forms.TextInput that widget gets his _has_changed from Widget class: https://github.com/django/django/blob/stable/1.5.x/django/forms/widgets.py#L211.

That function is not good for many value widgets because for initial values: None, [] it returns True...

You have to use _has_changed from: https://github.com/django/django/blob/stable/1.5.x/django/forms/widgets.py#L642.

This problem occurred when I try use that field in formset. Formset validates only changed forms, so now it will validate all forms in formset even extra ones.