Skip to content

Commit c686e17

Browse files
authored
Drop Django 1.11 support (#638)
1 parent ae6c47d commit c686e17

File tree

15 files changed

+43
-1035
lines changed

15 files changed

+43
-1035
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Pending
77
-------
88

99
* Prevent ``collections.abc.Sequence`` warning.
10+
* Drop Django 1.11 support. Only Django 2.0+ is supported now.
1011

1112
3.3.0 (2019-12-10)
1213
------------------

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Requirements
88
These are the supported, tested versions of Django-MySQL's requirements:
99

1010
* Python: 3.5, 3.6, 3.7, 3.8
11-
* Django: 1.11, 2.0, 2.1, 2.2, 3.0
11+
* Django: 2.0, 2.1, 2.2, 3.0
1212
* MySQL: 5.6, 5.7 / MariaDB: 10.0, 10.1, 10.2, 10.3
1313
* mysqlclient: 1.3
1414

requirements/compile.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111
common_args = ["-m", "piptools", "compile", "--generate-hashes"] + sys.argv[1:]
1212
# mysqlclient requirements found on each version's "Databases" documentation page:
1313
# https://docs.djangoproject.com/en/2.2/ref/databases/#id6
14-
subprocess.run(
15-
[
16-
"python3.5",
17-
*common_args,
18-
"-P",
19-
"Django>=1.11,<2.0",
20-
"-P",
21-
"mysqlclient>=1.3.3,<=1.3.13",
22-
"-o",
23-
"py35-django111.txt",
24-
],
25-
check=True,
26-
)
2714
subprocess.run(
2815
[
2916
"python3.5",
@@ -63,19 +50,6 @@
6350
],
6451
check=True,
6552
)
66-
subprocess.run(
67-
[
68-
"python3.6",
69-
*common_args,
70-
"-P",
71-
"Django>=1.11,<2.0",
72-
"-P",
73-
"mysqlclient>=1.3.3,<=1.3.13",
74-
"-o",
75-
"py36-django111.txt",
76-
],
77-
check=True,
78-
)
7953
subprocess.run(
8054
[
8155
"python3.6",
@@ -128,19 +102,6 @@
128102
],
129103
check=True,
130104
)
131-
subprocess.run(
132-
[
133-
"python3.7",
134-
*common_args,
135-
"-P",
136-
"Django>=1.11,<2.0",
137-
"-P",
138-
"mysqlclient>=1.3.3,<=1.3.13",
139-
"-o",
140-
"py37-django111.txt",
141-
],
142-
check=True,
143-
)
144105
subprocess.run(
145106
[
146107
"python3.7",

requirements/py35-django111.txt

Lines changed: 0 additions & 291 deletions
This file was deleted.

requirements/py36-django111.txt

Lines changed: 0 additions & 291 deletions
This file was deleted.

requirements/py37-django111.txt

Lines changed: 0 additions & 291 deletions
This file was deleted.

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ keywords =
1717
classifiers =
1818
Development Status :: 5 - Production/Stable
1919
Framework :: Django
20-
Framework :: Django :: 1.11
2120
Framework :: Django :: 2.0
2221
Framework :: Django :: 2.1
2322
Framework :: Django :: 2.2
@@ -41,7 +40,7 @@ package_dir=
4140
=src
4241
packages = find:
4342
include_package_data = True
44-
install_requires = Django>=1.11
43+
install_requires = Django>=2.0
4544
python_requires = >=3.5
4645
zip_safe = False
4746

src/django_mysql/models/fields/bit.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
import django
21
from django.db.models import BooleanField, NullBooleanField
32

43

54
class Bit1Mixin:
65
def db_type(self, connection):
76
return "bit(1)"
87

9-
if django.VERSION >= (2, 0):
10-
11-
def from_db_value(self, value, expression, connection):
12-
# Meant to be binary/bytes but can come back as unicode strings
13-
if isinstance(value, bytes):
14-
value = value == b"\x01"
15-
elif isinstance(value, str):
16-
# Only on older versions of mysqlclient and Py 2.7
17-
value = value == "\x01" # pragma: no cover
18-
return value
19-
20-
else:
21-
22-
def from_db_value(self, value, expression, connection, context):
23-
# Meant to be binary/bytes but can come back as unicode strings
24-
if isinstance(value, bytes):
25-
value = value == b"\x01"
26-
elif isinstance(value, str):
27-
# Only on older versions of mysqlclient and Py 2.7
28-
value = value == "\x01" # pragma: no cover
29-
return value
8+
def from_db_value(self, value, expression, connection):
9+
# Meant to be binary/bytes but can come back as unicode strings
10+
if isinstance(value, bytes):
11+
value = value == b"\x01"
12+
elif isinstance(value, str):
13+
# Only on older versions of mysqlclient and Py 2.7
14+
value = value == "\x01" # pragma: no cover
15+
return value
3016

3117
def get_prep_value(self, value):
3218
if value is None:

src/django_mysql/models/fields/dynamic.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
from datetime import date, datetime, time
33

4-
import django
54
from django.core import checks
65
from django.db.models import (
76
DateField,
@@ -191,17 +190,9 @@ def to_python(self, value):
191190
return json.loads(value) # serialization framework
192191
return value
193192

194-
if django.VERSION >= (2, 0):
195-
196-
def from_db_value(self, value, expression, connection):
197-
# Used to always convert a value from the database
198-
return self.to_python(value)
199-
200-
else:
201-
202-
def from_db_value(self, value, expression, connection, context):
203-
# Used to always convert a value from the database
204-
return self.to_python(value)
193+
def from_db_value(self, value, expression, connection):
194+
# Used to always convert a value from the database
195+
return self.to_python(value)
205196

206197
def get_prep_value(self, value):
207198
value = super().get_prep_value(value)

src/django_mysql/models/fields/json.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22

3-
import django
43
from django.core import checks
54
from django.db.models import Field, IntegerField, Transform
65

@@ -136,19 +135,10 @@ def get_transform(self, name):
136135
return transform # pragma: no cover
137136
return KeyTransformFactory(name)
138137

139-
if django.VERSION >= (2, 0):
140-
141-
def from_db_value(self, value, expression, connection):
142-
if isinstance(value, str):
143-
return self.json_decoder.decode(value)
144-
return value
145-
146-
else:
147-
148-
def from_db_value(self, value, expression, connection, context):
149-
if isinstance(value, str):
150-
return self.json_decoder.decode(value)
151-
return value
138+
def from_db_value(self, value, expression, connection):
139+
if isinstance(value, str):
140+
return self.json_decoder.decode(value)
141+
return value
152142

153143
def get_prep_value(self, value):
154144
if value is not None and not isinstance(value, str):

0 commit comments

Comments
 (0)