Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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...
commit 9328ef0e84db2559af56d24c40e6b24b74e29a6f 1 parent 1c061ef
Aymeric Augustin authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  django/forms/models.py
2  django/forms/models.py
@@ -715,7 +715,7 @@ def __init__(self, data=None, files=None, instance=None,
715 715
         if self.instance.pk:
716 716
             qs = queryset.filter(**{self.fk.name: self.instance})
717 717
         else:
718  
-            qs = queryset.none()
  718
+            qs = queryset.filter(pk__in=[])
719 719
         super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix,
720 720
                                                 queryset=qs, **kwargs)
721 721
 

0 notes on commit 9328ef0

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