diff --git a/promote_content/queryset.py b/promote_content/queryset.py index b18bb97..f2e5c33 100644 --- a/promote_content/queryset.py +++ b/promote_content/queryset.py @@ -51,7 +51,9 @@ def curated(self, context=None): start_filter = Q(**start_lte) | Q(**start_null) end_filter = Q(**end_gte) | Q(**end_null) - curated = self.filter(start_filter, end_filter) + curated_filter = {"%s__isnull" % curation_rel: False} + + curated = self.filter(start_filter, end_filter).filter(**curated_filter) if context is not None: # only include curation for supplied context @@ -66,6 +68,8 @@ def curated(self, context=None): ~Q(end_filter) ) else: + + # exclude curation that are applied to a particular context no_context_filter = { "%s__context_type__isnull" % curation_rel: False @@ -99,6 +103,9 @@ def curated(self, context=None): return uncurated_qs + def ordered(self): + return super(CuratedQuerySet, self).ordered() or self._is_curated + def __len__(self): if self._is_curated: return super(CuratedQuerySet, self._curated_qs).__len__() + super(CuratedQuerySet, self).__len__() diff --git a/promote_content/tests/test_settings.py b/promote_content/tests/test_settings.py index e5d32c3..528520a 100644 --- a/promote_content/tests/test_settings.py +++ b/promote_content/tests/test_settings.py @@ -22,3 +22,4 @@ 'django.contrib.admin', 'promote_content', ) +SECRET_KEY = '5-*-_t#&arg*mye1-48hv*c+pqsy6vlk2p=hp*6cezmiihiigh'