From 97a7ef066b587668a659ef7d7224b023ef2c9606 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Tue, 1 Mar 2016 09:48:50 +0000 Subject: [PATCH] Fixing AppNotReady errors in register() --- src/watson/search.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/watson/search.py b/src/watson/search.py index 54fa1a8..de56b33 100644 --- a/src/watson/search.py +++ b/src/watson/search.py @@ -11,7 +11,6 @@ from weakref import WeakValueDictionary from django.conf import settings from django.core.signals import request_finished from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist -from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models import Q from django.db.models.query import QuerySet @@ -424,6 +423,7 @@ class SearchEngine(object): def _get_entries_for_obj(self, obj): """Returns a queryset of entries associate with the given obj.""" + from django.contrib.contenttypes.models import ContentType from watson.models import SearchEntry, has_int_pk model = obj.__class__ content_type = ContentType.objects.get_for_model(model) @@ -449,6 +449,7 @@ class SearchEngine(object): def _update_obj_index_iter(self, obj): """Either updates the given object index, or yields an unsaved search entry.""" + from django.contrib.contenttypes.models import ContentType from watson.models import SearchEntry model = obj.__class__ adapter = self.get_adapter(model) @@ -501,6 +502,7 @@ class SearchEngine(object): def _create_model_filter(self, models): """Creates a filter for the given model/queryset list.""" + from django.contrib.contenttypes.models import ContentType from watson.models import has_int_pk filters = Q() for model in models: