mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16: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 ina35d2a4510. Backport ofbff748df3efrom master.
This commit is contained in:
@@ -40,6 +40,7 @@ class FlexibleFieldLookupDict:
|
||||
'real': 'FloatField',
|
||||
'text': 'TextField',
|
||||
'char': 'CharField',
|
||||
'varchar': 'CharField',
|
||||
'blob': 'BinaryField',
|
||||
'date': 'DateField',
|
||||
'datetime': 'DateTimeField',
|
||||
@@ -47,14 +48,8 @@ class FlexibleFieldLookupDict:
|
||||
}
|
||||
|
||||
def __getitem__(self, key):
|
||||
key = key.lower()
|
||||
try:
|
||||
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
|
||||
key = key.lower().split('(', 1)[0].strip()
|
||||
return self.base_data_types_reverse[key]
|
||||
|
||||
|
||||
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
|
||||
Reference in New Issue
Block a user