Skip to content

Commit

Permalink
Merge pull request #49 from suriya/patch-1
Browse files Browse the repository at this point in the history
Fix get_model Deprecation warning with Django 1.9
  • Loading branch information
klen committed Nov 23, 2015
2 parents 9afa8eb + 8f93350 commit 2fe83e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mixer/backend/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
else:
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation)
try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
from django.db.models.loading import get_model
from django.contrib.contenttypes.models import ContentType
from django.core.files.base import ContentFile
from django.core.validators import (
Expand Down Expand Up @@ -133,7 +138,7 @@ def __load_cls(cls, cls_type):
if isinstance(cls_type, _.string_types):
if '.' in cls_type:
app_label, model_name = cls_type.split(".")
return models.get_model(app_label, model_name)
return get_model(app_label, model_name)

else:
try:
Expand Down

0 comments on commit 2fe83e8

Please sign in to comment.