mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
[2.2.x] Fixed #30115 -- Fixed SQLite introspection crash with a varchar primary key.
Removed obsolete max_length handling for CharField that caused the issue. Regression in a35d2a4510d5beec398b1007aaa26492d6aedf97. Backport of bff748df3e1e1c0077e02df2b77bda2b827ad129 from master.
This commit is contained in:
parent
6ce7887f13
commit
e53e64280d
@ -40,6 +40,7 @@ class FlexibleFieldLookupDict:
|
|||||||
'real': 'FloatField',
|
'real': 'FloatField',
|
||||||
'text': 'TextField',
|
'text': 'TextField',
|
||||||
'char': 'CharField',
|
'char': 'CharField',
|
||||||
|
'varchar': 'CharField',
|
||||||
'blob': 'BinaryField',
|
'blob': 'BinaryField',
|
||||||
'date': 'DateField',
|
'date': 'DateField',
|
||||||
'datetime': 'DateTimeField',
|
'datetime': 'DateTimeField',
|
||||||
@ -47,14 +48,8 @@ class FlexibleFieldLookupDict:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
key = key.lower()
|
key = key.lower().split('(', 1)[0].strip()
|
||||||
try:
|
return self.base_data_types_reverse[key]
|
||||||
return self.base_data_types_reverse[key]
|
|
||||||
except KeyError:
|
|
||||||
size = get_field_size(key)
|
|
||||||
if size is not None:
|
|
||||||
return ('CharField', {'max_length': size})
|
|
||||||
raise KeyError
|
|
||||||
|
|
||||||
|
|
||||||
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user