Use new get_model method

remotes/origin/fix-throttling-bug
David Barragán Merino 2017-08-21 10:32:34 +02:00 committed by Alejandro Alonso
parent b32a8695de
commit 4c6ac330bf
1 changed files with 2 additions and 1 deletions

View File

@ -56,6 +56,7 @@ python primitives.
response content is handled by parsers and renderers. response content is handled by parsers and renderers.
""" """
from decimal import Decimal from decimal import Decimal
from django.apps import apps
from django.core.paginator import Page from django.core.paginator import Page
from django.db import models from django.db import models
from django.forms import widgets from django.forms import widgets
@ -98,7 +99,7 @@ def _resolve_model(obj):
""" """
if type(obj) == str and len(obj.split(".")) == 2: if type(obj) == str and len(obj.split(".")) == 2:
app_name, model_name = obj.split(".") app_name, model_name = obj.split(".")
return models.get_model(app_name, model_name) return apps.get_model(app_name, model_name)
elif inspect.isclass(obj) and issubclass(obj, models.Model): elif inspect.isclass(obj) and issubclass(obj, models.Model):
return obj return obj
else: else: