Skip to content

Commit 83d0fe7

Browse files
Fix deprecation warnings with Django 1.7+
1 parent 3400820 commit 83d0fe7

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

AUTHORS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ Authors
44
Massimiliano Pippi
55
Federico Frenguelli
66
Stéphane Raimbault
7-
Emanuele Palazzetti
7+
Emanuele Palazzetti
8+
9+
Contributors
10+
============
11+
12+
David Fischer

oauth2_provider/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
from django.core.urlresolvers import reverse
44
from django.db import models
55
from django.utils import timezone
6-
from django.db.models import get_model
6+
try:
7+
# Django's new application loading system
8+
from django.apps import apps
9+
get_model = apps.get_model
10+
except ImportError:
11+
from django.db.models import get_model
712
from django.utils.translation import ugettext_lazy as _
813
from django.utils.encoding import python_2_unicode_compatible
914
from django.core.exceptions import ImproperlyConfigured

oauth2_provider/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
import six
2121

2222
from django.conf import settings
23-
from django.utils import importlib
23+
try:
24+
# Available in Python 2.7+
25+
import importlib
26+
except ImportError:
27+
from django.utils import importlib
2428

2529

2630
USER_SETTINGS = getattr(settings, 'OAUTH2_PROVIDER', None)

0 commit comments

Comments
 (0)