Skip to content

Commit

Permalink
Merge pull request #54 from richardbarran/django22
Browse files Browse the repository at this point in the history
Django 2.2+ compatibility
  • Loading branch information
SebCorbin committed Apr 18, 2020
2 parents b5e986c + 34699ca commit bdb15db
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,6 +3,7 @@
*.pyc
.project
.pydevproject
.idea/
.settings
dist/
build/
Expand Down
5 changes: 5 additions & 0 deletions docs/changes.rst
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

trunk
-----

- Django 2.1, 2.2 compatibility

1.3.0
-----

Expand Down
2 changes: 1 addition & 1 deletion envelope/views.py
Expand Up @@ -73,7 +73,7 @@ def get_initial(self):
"""
initial = super(ContactView, self).get_initial().copy()
user = self.request.user
if user.is_authenticated():
if user.is_authenticated() if callable(user.is_authenticated) else user.is_authenticated:
# the user might not have a full name set in the model
if user.get_full_name():
sender = '%s (%s)' % (user.get_username(), user.get_full_name())
Expand Down
3 changes: 1 addition & 2 deletions example_project/settings.py
Expand Up @@ -33,9 +33,8 @@

SECRET_KEY = 'n5)bgcx7xwk^fhnv+w&qaap)lryz8in*a293=!d=*!%js7^mdr'

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down
3 changes: 1 addition & 2 deletions tests/settings.py
Expand Up @@ -32,9 +32,8 @@
}
}

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down
7 changes: 6 additions & 1 deletion tests/test_views.py
Expand Up @@ -10,7 +10,12 @@

from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse

try:
from django.core.urlresolvers import reverse
except ImportError:
from django.urls import reverse

from django.test import TestCase

try:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -22,4 +22,4 @@ DJANGO =
1.11: django111
2.2: django22
3.0: django30
master: djangomaster
master: djangomaster

0 comments on commit bdb15db

Please sign in to comment.