Add test for callable queryset with Unselectable…
This commit is contained in:
parent
ded824bddd
commit
8ea5775d61
1 changed files with 0 additions and 2 deletions
|
@ -26,8 +26,6 @@ class KeepUnselectableModelFormMixin:
|
||||||
if self.instance.pk:
|
if self.instance.pk:
|
||||||
previous = getattr(self.instance, field_name).all()
|
previous = getattr(self.instance, field_name).all()
|
||||||
selectable = self.fields[field_name].queryset
|
selectable = self.fields[field_name].queryset
|
||||||
if callable(selectable):
|
|
||||||
selectable = selectable()
|
|
||||||
return previous.exclude(pk__in=[o.pk for o in selectable])
|
return previous.exclude(pk__in=[o.pk for o in selectable])
|
||||||
else:
|
else:
|
||||||
# Instance is being created, there is no previous item.
|
# Instance is being created, there is no previous item.
|
||||||
|
|
Loading…
Reference in a new issue