Permalink
Browse files

Corrections to django-haystack updates.

  • Loading branch information...
1 parent 56683eb commit b7a3d0497124d2e701d37c46f36545358d2c3d27 @melinath melinath committed Jun 28, 2013
Showing with 5 additions and 5 deletions.
  1. +2 −2 localtv/search_indexes.py
  2. +3 −3 localtv/tasks.py
@@ -133,14 +133,14 @@ def _enqueue_fk_delete(self, instance, **kwargs):
def get_model(self):
return Video
- def index_queryset(self):
+ def index_queryset(self, using=None):
"""
Custom queryset to only search active videos and to annotate them
with the watch_count.
"""
model = self.get_model()
- return model._default_manager.filter(status=model.ACTIVE)
+ return model._default_manager.using(using).filter(status=model.ACTIVE)
def read_queryset(self):
"""
View
@@ -369,7 +369,7 @@ def haystack_update(app_label, model_name, pks, remove=True):
"""
model_class = get_model(app_label, model_name)
- using = connection_router.for_write()
+ using = connection_router.for_write()[0]
backend = connections[using].get_backend()
index = connections[using].get_unified_index().get_index(model_class)
@@ -390,7 +390,7 @@ def haystack_remove(app_label, model_name, pks):
Removes the haystack records for any instances with the given pks.
"""
- using = connection_router.for_write()
+ using = connection_router.for_write()[0]
backend = connections[using].get_backend()
def callback():
@@ -410,7 +410,7 @@ def haystack_batch_update(app_label, model_name, pks=None, start=None,
"""
model_class = get_model(app_label, model_name)
- using = connection_router.for_write()
+ using = connection_router.for_write()[0]
index = connections[using].get_unified_index().get_index(model_class)
pk_qs = index.index_queryset()

0 comments on commit b7a3d04

Please sign in to comment.