Loading django/db/models/query.py +1 −1 Original line number Diff line number Diff line Loading @@ -1171,7 +1171,7 @@ class QuerySet(object): class InstanceCheckMeta(type): def __instancecheck__(self, instance): return instance.query.is_empty() return isinstance(instance, QuerySet) and instance.query.is_empty() class EmptyQuerySet(six.with_metaclass(InstanceCheckMeta)): Loading tests/basic/tests.py +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ class ModelTest(TestCase): with self.assertRaises(TypeError): EmptyQuerySet() self.assertIsInstance(Article.objects.none(), EmptyQuerySet) self.assertFalse(isinstance('', EmptyQuerySet)) def test_emptyqs_values(self): # test for #15959 Loading Loading
django/db/models/query.py +1 −1 Original line number Diff line number Diff line Loading @@ -1171,7 +1171,7 @@ class QuerySet(object): class InstanceCheckMeta(type): def __instancecheck__(self, instance): return instance.query.is_empty() return isinstance(instance, QuerySet) and instance.query.is_empty() class EmptyQuerySet(six.with_metaclass(InstanceCheckMeta)): Loading
tests/basic/tests.py +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ class ModelTest(TestCase): with self.assertRaises(TypeError): EmptyQuerySet() self.assertIsInstance(Article.objects.none(), EmptyQuerySet) self.assertFalse(isinstance('', EmptyQuerySet)) def test_emptyqs_values(self): # test for #15959 Loading