mirror of https://github.com/django/django.git
Refs #27025 -- Fixed ArrayField querying on Python 3.6.
Python 3.6 parses strings like '0_1' as numeric literals. http://bugs.python.org/issue26331
This commit is contained in:
parent
3347dc6b4e
commit
b5aac66b28
|
@ -129,13 +129,14 @@ class ArrayField(Field):
|
||||||
transform = super(ArrayField, self).get_transform(name)
|
transform = super(ArrayField, self).get_transform(name)
|
||||||
if transform:
|
if transform:
|
||||||
return transform
|
return transform
|
||||||
try:
|
if '_' not in name:
|
||||||
index = int(name)
|
try:
|
||||||
except ValueError:
|
index = int(name)
|
||||||
pass
|
except ValueError:
|
||||||
else:
|
pass
|
||||||
index += 1 # postgres uses 1-indexing
|
else:
|
||||||
return IndexTransformFactory(index, self.base_field)
|
index += 1 # postgres uses 1-indexing
|
||||||
|
return IndexTransformFactory(index, self.base_field)
|
||||||
try:
|
try:
|
||||||
start, end = name.split('_')
|
start, end = name.split('_')
|
||||||
start = int(start) + 1
|
start = int(start) + 1
|
||||||
|
|
Loading…
Reference in New Issue