diff --git a/smart_selects/form_fields.py b/smart_selects/form_fields.py index 274c941..767b01a 100644 --- a/smart_selects/form_fields.py +++ b/smart_selects/form_fields.py @@ -1,7 +1,10 @@ -from django.db.models 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 django.forms.models import ModelChoiceField, ModelMultipleChoiceField from django.forms import ChoiceField - from smart_selects.widgets import ChainedSelect, ChainedSelectMultiple from django.utils.encoding import force_text import traceback