Skip to content

Commit d303f71

Browse files
authored
Merge pull request #105 from atombrella/django_40
Add support for Django 4.0. Add missing classifier for Python 3.7.
2 parents efa5f04 + 8d3d777 commit d303f71

File tree

10 files changed

+27
-17
lines changed

10 files changed

+27
-17
lines changed

.circleci/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ workflows:
5959
- tox:
6060
tox_env: "py39-django32"
6161
python_version: "3.9"
62+
- tox:
63+
tox_env: "py310-django32"
64+
python_version: "3.10"
65+
- tox:
66+
tox_env: "py38-django40"
67+
python_version: "3.8"
68+
- tox:
69+
tox_env: "py39-django40"
70+
python_version: "3.9"
71+
- tox:
72+
tox_env: "py310-django40"
73+
python_version: "3.10"
6274
- tox:
6375
tox_env: "lint"
6476
python_version: "3.8"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pip-log.txt
3737
.coverage
3838
.tox
3939
nosetests.xml
40+
coverage.xml
4041

4142
# Translations
4243
*.mo

django_nyt/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def login_required_ajax(f):
2828

2929
@wraps(f)
3030
def wrapper(request, *args, **kwargs):
31-
if request.is_ajax():
31+
if request.headers.get('x-requested-with') == 'XMLHttpRequest':
3232
if not request.user or not request.user.is_authenticated:
3333
return json_view(lambda *a,
3434
**kw: {'error': 'not logged in'})(request,

django_nyt/tests/test_management.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def test_notifymail(self):
4141
# It's normal for this command to exit
4242
pass
4343

44-
pid = open(pid_file.name, 'r').read()
44+
with open(pid_file.name, 'r') as fp:
45+
pid = fp.read()
4546
os.unlink(pid_file.name)
4647

4748
# Give it a second to start

django_nyt/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from django.conf.urls import include
2-
from django.conf.urls import url
1+
from django.urls import include, re_path as url
32

43
from . import views
54

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
keywords=["django", "notification" "alerts"],
1818
packages=find_packages(),
1919
zip_safe=False,
20-
install_requires=["django>=2.2,<3.3"],
20+
install_requires=["django>=2.2,<4.1"],
2121
classifiers=[
2222
'Development Status :: 5 - Production/Stable',
2323
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
@@ -32,8 +32,10 @@
3232
'Programming Language :: Python :: 3',
3333
'Programming Language :: Python :: 3.5',
3434
'Programming Language :: Python :: 3.6',
35+
'Programming Language :: Python :: 3.7',
3536
'Programming Language :: Python :: 3.8',
3637
'Programming Language :: Python :: 3.9',
38+
'Programming Language :: Python :: 3.10',
3739
'Programming Language :: Python :: 3 :: Only',
3840
],
3941
include_package_data=True,

test-project/testapp/urls.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
try:
2-
from django.urls import include, re_path as url
3-
except ImportError:
4-
from django.conf.urls import include, url
1+
from django.urls import include, re_path as url
52

63
from . import views
74

test-project/testproject/settings/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# django-nyt options
143143
##########################################
144144

145-
_enable_channels = True
145+
_enable_channels = False
146146
if _enable_channels:
147147
INSTALLED_APPS.append('channels')
148148
CHANNEL_LAYERS = {

test-project/testproject/urls.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
from django.conf import settings
33
from django.contrib import admin
44
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
5-
6-
try:
7-
from django.urls import include, re_path as url
8-
except ImportError:
9-
from django.conf.urls import include, url
5+
from django.urls import include, re_path as url
106

117

128
admin.autodiscover()

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
2-
# Ensure you add to .travis.yml if you add here
3-
envlist = {py35,py36,py37,py38,py39,pypy}-django{22,30,31,32}
2+
# Ensure you add to .circleci/config.yml if you add here
3+
envlist = {py35,py36,py37,py38,py39,pypy}-django{22,30,31,32},{py36,py37,py38,py39,py310}-django{32},{py38,py39,py310}-django{40},
44

55
[testenv]
66
passenv = CODECOV_TOKEN
@@ -21,13 +21,15 @@ deps =
2121
django30: Django>=3.0,<3.1
2222
django31: Django>=3.1,<3.2
2323
django32: Django>=3.2,<3.3
24+
django40: Django>=4.0,<4.1
2425

2526
basepython =
2627
py35: python3.5
2728
py36: python3.6
2829
py37: python3.7
2930
py38: python3.8
3031
py39: python3.9
32+
py310: python3.10
3133
pypy: python
3234

3335
[testenv:lint]

0 commit comments

Comments
 (0)