From 8607f5a3a165fae41a7fee3ee251053a0034109b Mon Sep 17 00:00:00 2001 From: Oleh Date: Tue, 11 Jan 2022 17:40:17 +0200 Subject: [PATCH] Proxy query attribute. --- queryset_sequence/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/queryset_sequence/__init__.py b/queryset_sequence/__init__.py index 1e9c1ec..777bf0d 100644 --- a/queryset_sequence/__init__.py +++ b/queryset_sequence/__init__.py @@ -1018,6 +1018,21 @@ def ordered(self): """ return bool(self._order_by) + @property + def query(self): + """ + Proxy query attribute. + + This attribute is used to provide a `.query` interface used by some of + django admin views. + """ + # The easiest way to create an empty object with arbitrary attributes. + query = lambda: None + query.order_by = self._order_by + query.select_related = self.select_related + query.prefetch_related = self.prefetch_related + return query + # Methods specific to QuerySetSequence. def get_querysets(self): """Returns a list of the QuerySet objects which form the sequence."""