You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've found that QuerySelectMultipleField sometimes has funny validation behaviour. When choosing a non-existing value and validating, we get that form.validate() returns True, but then validating again it returns False.
The problem seems to be in pre_validate that _invalid_formdata is not updated if _get_data is not called. So a fix to this would be:
defpre_validate(self, form):
data=self.dataifself._invalid_formdata:
raiseValidationError(self.gettext('Not a valid choice'))
elifdata:
obj_list=list(x[1] forxinself._get_object_list())
forvinself.data:
ifvnotinobj_list:
raiseValidationError(self.gettext('Not a valid choice'))
And a test (in QuerySelectMultipleFieldTest) that now fails, but would pass with the fix:
We've found that
QuerySelectMultipleField
sometimes has funny validation behaviour. When choosing a non-existing value and validating, we get thatform.validate()
returnsTrue
, but then validating again it returnsFalse
.The problem seems to be in
pre_validate
that_invalid_formdata
is not updated if_get_data
is not called. So a fix to this would be:And a test (in
QuerySelectMultipleFieldTest
) that now fails, but would pass with the fix:The text was updated successfully, but these errors were encountered: