diff --git a/braces/views/_forms.py b/braces/views/_forms.py index e2098200..fae4837c 100644 --- a/braces/views/_forms.py +++ b/braces/views/_forms.py @@ -1,11 +1,14 @@ from django.contrib import messages from django.core.exceptions import ImproperlyConfigured -from django.core.urlresolvers import reverse from django.utils import six from django.utils.decorators import method_decorator from django.utils.encoding import force_text from django.utils.functional import curry, Promise from django.views.decorators.csrf import csrf_exempt +try: + from django.urls import reverse +except ImportError: + from django.core.urlresolvers import reverse class CsrfExemptMixin(object): diff --git a/braces/views/_other.py b/braces/views/_other.py index fc2647ee..f77f5da7 100644 --- a/braces/views/_other.py +++ b/braces/views/_other.py @@ -1,7 +1,10 @@ from django.core.exceptions import ImproperlyConfigured -from django.core.urlresolvers import resolve from django.shortcuts import redirect from django.utils.encoding import force_text +try: + from django.urls import resolve +except ImportError: + from django.core.urlresolvers import resolve class SetHeadlineMixin(object): diff --git a/tests/test_access_mixins.py b/tests/test_access_mixins.py index 99c8abc5..9311a04b 100644 --- a/tests/test_access_mixins.py +++ b/tests/test_access_mixins.py @@ -8,8 +8,11 @@ from django import VERSION as DJANGO_VERSION from django.test.utils import override_settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied -from django.core.urlresolvers import reverse_lazy from django.http import Http404, HttpResponse +try: + from django.urls import reverse_lazy +except ImportError: + from django.core.urlresolvers import reverse_lazy from .compat import force_text from .factories import GroupFactory, UserFactory @@ -716,7 +719,7 @@ def test_outdated_login(self): self.client.login(username=user.username, password='asdf1234') resp = self.client.get(self.outdated_view_url) assert resp.status_code == 302 - + def test_not_logged_in(self): last_login = datetime.datetime.now() user = UserFactory(last_login=last_login)