Add test for callable queryset with Unselectable…

This commit is contained in:
Aurélien Delobelle 2017-09-29 23:15:57 +02:00
parent ded824bddd
commit 8ea5775d61

View file

@ -26,8 +26,6 @@ class KeepUnselectableModelFormMixin:
if self.instance.pk:
previous = getattr(self.instance, field_name).all()
selectable = self.fields[field_name].queryset
if callable(selectable):
selectable = selectable()
return previous.exclude(pk__in=[o.pk for o in selectable])
else:
# Instance is being created, there is no previous item.