diff --git a/AUTHORS.rst b/AUTHORS.rst index 62d6561..1776b2b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -35,4 +35,5 @@ sayane Tony Aldridge Travis Swicegood Trey Hunner +Karl Wan Nan Wo zyegfryed diff --git a/model_utils/managers.py b/model_utils/managers.py index 2247d8a..9392e69 100644 --- a/model_utils/managers.py +++ b/model_utils/managers.py @@ -53,10 +53,13 @@ class InheritanceQuerySetMixin(object): new_qs.subclasses = subclasses return new_qs - def _clone(self, **kwargs): + def _clone(self, klass=None, setup=False, **kwargs): for name in ['subclasses', '_annotated']: if hasattr(self, name): kwargs[name] = getattr(self, name) + if django.VERSION < (1, 9): + kwargs['klass'] = klass + kwargs['setup'] = setup return super(InheritanceQuerySetMixin, self)._clone(**kwargs) def annotate(self, *args, **kwargs): diff --git a/model_utils/tests/tests.py b/model_utils/tests/tests.py index dd40506..d32bf86 100644 --- a/model_utils/tests/tests.py +++ b/model_utils/tests/tests.py @@ -763,6 +763,11 @@ class InheritanceManagerTests(TestCase): set(expected_related_names)) + def test_filter_on_values_queryset(self): + queryset = InheritanceManagerTestChild1.objects.values('id').filter(pk=self.child1.pk) + self.assertEqual(list(queryset), [{'id': self.child1.pk}]) + + class InheritanceManagerUsingModelsTests(TestCase): def setUp(self):