Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #20 from stefanfoulis/feature/multisite-plan-B

adds alternative implementation for multisite support
  • Loading branch information...
commit ee7081decc249e5c4cd5d7ec90a76ff89a799134 2 parents dba67ab + cde1529
@piquadrat authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 cms_search/search_indexes.py
View
19 cms_search/search_indexes.py
@@ -2,7 +2,9 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
+from django.contrib.sites.models import Site
from django.db.models import Q
+from django.db.models.query import EmptyQuerySet
from django.template import RequestContext
from django.test.client import RequestFactory
from django.utils.encoding import force_unicode
@@ -89,13 +91,16 @@ def prepare(self, obj):
def index_queryset(self):
# get the correct language and exclude pages that have a redirect
- qs = super(_PageIndex, self).index_queryset()
- qs = qs.published().filter(
- Q(title_set__language=language_code) & (Q(title_set__redirect__exact='') | Q(title_set__redirect__isnull=True)))
- if 'publisher' in settings.INSTALLED_APPS:
- qs = qs.filter(publisher_is_draft=True)
- qs = qs.distinct()
- return qs
+ base_qs = super(_PageIndex, self).index_queryset()
+ result_qs = EmptyQuerySet()
+ for site_obj in Site.objects.all():
+ qs = base_qs.published(site=site_obj.id).filter(
+ Q(title_set__language=language_code) & (Q(title_set__redirect__exact='') | Q(title_set__redirect__isnull=True)))
+ if 'publisher' in settings.INSTALLED_APPS:
+ qs = qs.filter(publisher_is_draft=True)
+ qs = qs.distinct()
+ result_qs |= qs
+ return result_qs
return _PageIndex
Please sign in to comment.
Something went wrong with that request. Please try again.