mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[1.5.x] Avoided a possible regression in 5097d3c5.
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.
This commit is contained in:
@@ -715,7 +715,7 @@ class BaseInlineFormSet(BaseModelFormSet):
|
|||||||
if self.instance.pk:
|
if self.instance.pk:
|
||||||
qs = queryset.filter(**{self.fk.name: self.instance})
|
qs = queryset.filter(**{self.fk.name: self.instance})
|
||||||
else:
|
else:
|
||||||
qs = queryset.none()
|
qs = queryset.filter(pk__in=[])
|
||||||
super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix,
|
super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix,
|
||||||
queryset=qs, **kwargs)
|
queryset=qs, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user