Skip to content

Commit

Permalink
Merge pull request #215 from jleclanche/master
Browse files Browse the repository at this point in the history
Fix reverse() imports on Django 2.0
  • Loading branch information
kennethlove authored Feb 1, 2017
2 parents b0fb4a7 + e541cae commit 2a71087
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion braces/views/_forms.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
5 changes: 4 additions & 1 deletion braces/views/_other.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
7 changes: 5 additions & 2 deletions tests/test_access_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2a71087

Please sign in to comment.