From f480f18e3c88bd91914ad862a2dec0aaf8e8ea21 Mon Sep 17 00:00:00 2001 From: Mateusz Barszcz Date: Tue, 9 Aug 2016 11:52:03 +0200 Subject: [PATCH] Fix imports in Django 1.9 --- queued_search/management/commands/process_search_queue.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/queued_search/management/commands/process_search_queue.py b/queued_search/management/commands/process_search_queue.py index a1af5dc..9cc4be3 100644 --- a/queued_search/management/commands/process_search_queue.py +++ b/queued_search/management/commands/process_search_queue.py @@ -4,7 +4,13 @@ from django.conf import settings from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.core.management.base import NoArgsCommand -from django.db.models.loading import get_model + +try: + from django.apps import apps + get_model = apps.get_model +except ImportError: + from django.db.models.loading import get_model + from haystack import connections from haystack.constants import DEFAULT_ALIAS from haystack.exceptions import NotHandled