Skip to content
Browse files

[1.5.x] Avoided a possible regression in 5097d3c.

QuerySet.none() returns an instance of EmptyQuerySet, which may have
undesirable side effects in the presence of custom query set classes.

The implementation of .none() was refactored in master to have the same
effect as .filter(pk__in=[]).

Refs #19652.

Thanks Simon Charrette for the report.
  • Loading branch information...
1 parent 1c061ef commit 9328ef0e84db2559af56d24c40e6b24b74e29a6f @aaugustin aaugustin committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 django/forms/models.py
View
2 django/forms/models.py
@@ -715,7 +715,7 @@ def __init__(self, data=None, files=None, instance=None,
if self.instance.pk:
qs = queryset.filter(**{self.fk.name: self.instance})
else:
- qs = queryset.none()
+ qs = queryset.filter(pk__in=[])
super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix,
queryset=qs, **kwargs)

0 comments on commit 9328ef0

Please sign in to comment.
Something went wrong with that request. Please try again.