Open
Description
When working with QuerySelectMultipleField
, the empty form works ok,
but when the edit form is built from an object like form = MyForm(obj=obj)
then the multiple select field does not show the selected field.
In other words it always shows none of the options to be selected
but in reality there could be some of them selected.
I think the fix is in the data
property here:
Which instead should be like:
def _get_data(...):
formdata = self._formdata
if formdata is not None:
data = []
for pk, obj in self._object_list:
if not formdata:
break
elif pk in formdata:
formdata.remove(pk)
data.append(obj)
if formdata:
self._invalid_formdata = True
self.data = data or self._data # This change here fixed it
return self._data
I don't know if a PR for this would be accepted or not, I could do that anyway.
Metadata
Metadata
Assignees
Labels
No labels