Skip to content

Commit 3514d4c

Browse files
authored
Merge pull request #55 from yceruto/django3_support
Add django3 support
2 parents c0bbbd4 + a767f34 commit 3514d4c

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.travis.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
sudo: required
2-
dist: xenial
31
language: python
42

53
python:
64
- 3.5
75
- 3.6
86
- 3.7
7+
- 3.8
98

109
env:
1110
- DJANGO_VERSION=2.*
11+
- DJANGO_VERSION=3.*
12+
13+
matrix:
14+
exclude:
15+
- python: 3.5
16+
env: DJANGO_VERSION=3.*
17+
- python: 3.8
18+
env: DJANGO_VERSION=2.*
1219

1320
install:
1421
- pip install django==$DJANGO_VERSION

django_ajax/decorators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"""
44
from __future__ import unicode_literals
55

6-
from functools import wraps
6+
from functools import wraps, WRAPPER_ASSIGNMENTS
77

88
from django.http import HttpResponseBadRequest
9-
from django.utils.decorators import available_attrs
109

1110
from django_ajax.shortcuts import render_to_json
1211

@@ -57,7 +56,7 @@ def my_view(request):
5756
5857
"""
5958
def decorator(func):
60-
@wraps(func, assigned=available_attrs(func))
59+
@wraps(func, assigned=WRAPPER_ASSIGNMENTS)
6160
def inner(request, *args, **kwargs):
6261
if mandatory and not request.is_ajax():
6362
return HttpResponseBadRequest()

tests/ajaxdecorator/app/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import unicode_literals
22
from datetime import datetime
33
from django.test import TestCase
4-
from django.utils import six
54
from django_ajax.encoder import LazyJSONEncoder
65
import json
76

@@ -18,7 +17,7 @@ def post(self, uri, data=None):
1817

1918
self.assertEquals(200, resp.status_code)
2019
self.assertEquals('application/json', response['Content-Type'])
21-
if isinstance(response.content, six.text_type):
20+
if isinstance(response.content, str):
2221
return response, json.loads(response.content)
2322
else:
2423
return response, json.loads(response.content.decode('utf-8'))

tests/ajaxmiddleware/app/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import unicode_literals
22
from datetime import datetime
33
from django.test import TestCase
4-
from django.utils import six
54
from django_ajax.encoder import LazyJSONEncoder
65
import json
76

@@ -18,7 +17,7 @@ def post(self, uri, data=None):
1817

1918
self.assertEquals(200, resp.status_code)
2019
self.assertEquals('application/json', response['Content-Type'])
21-
if isinstance(response.content, six.text_type):
20+
if isinstance(response.content, str):
2221
return response, json.loads(response.content)
2322
else:
2423
return response, json.loads(response.content.decode('utf-8'))

0 commit comments

Comments
 (0)