From a5cdb1a983b8f6430b8d37e27464c754145c53e3 Mon Sep 17 00:00:00 2001 From: Keryn Knight Date: Wed, 22 Jun 2016 11:48:58 +0100 Subject: [PATCH] Keep track of whether or not we could yield root nodes. Should allow me to raise an error only when passing in models(None) and it was previously set to False. --- inheritrix.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inheritrix.py b/inheritrix.py index 4ecbe53..29b9ff6 100644 --- a/inheritrix.py +++ b/inheritrix.py @@ -127,10 +127,12 @@ class InheritingQuerySet(QuerySet): def __init__(self, *args, **kwargs): super(InheritingQuerySet, self).__init__(*args, **kwargs) self._our_joins = [] + self._include_self = True def _clone(self, *args, **kwargs): clone = super(InheritingQuerySet, self)._clone(*args, **kwargs) clone._our_joins = self._our_joins[:] + clone._include_self = self._include_self return clone def select_subclasses(self, *subclasses): @@ -170,6 +172,7 @@ def models(self, *models, **options): if 'include_self' not in options or options['include_self'] is not True: x = generate_q_filters(lookups=all_combinations) clone.query.add_q(x) + clone._include_self = False return clone def iterator(self):