Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion promote_content/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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__()
Expand Down
1 change: 1 addition & 0 deletions promote_content/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
'django.contrib.admin',
'promote_content',
)
SECRET_KEY = '5-*-_t#&arg*mye1-48hv*c+pqsy6vlk2p=hp*6cezmiihiigh'