Changed import to use the new apps module for get_model, this removes

the Django warning:
site-packages/auditlog/middleware.py:9: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
  from django.db.models.loading import get_model
This commit is contained in:
jay7958 2015-08-20 13:49:22 -05:00
parent 59fc9eff18
commit 655e02e806

View file

@ -6,7 +6,7 @@ import time
from django.conf import settings
from django.db.models.signals import pre_save
from django.utils.functional import curry
from django.db.models.loading import get_model
from django.apps import apps
from auditlog.models import LogEntry
@ -65,9 +65,9 @@ class AuditlogMiddleware(object):
"""
try:
app_label, model_name = settings.AUTH_USER_MODEL.split('.')
auth_user_model = get_model(app_label, model_name)
auth_user_model = apps.get_model(app_label, model_name)
except ValueError:
auth_user_model = get_model('auth', 'user')
auth_user_model = apps.get_model('auth', 'user')
if sender == LogEntry and isinstance(user, auth_user_model) and instance.actor is None:
instance.actor = user
if hasattr(threadlocal, 'auditlog'):