Commit fcd0bf0b authored by Fil Mackay's avatar Fil Mackay

Handle 'MAX' column lengths

This tests to see whether the length is a int first, so it excludes the 'MAX' case (unlimited column size).
parent ea523fbd
...@@ -263,7 +263,7 @@ class AdminModelConverter(ModelConverterBase): ...@@ -263,7 +263,7 @@ class AdminModelConverter(ModelConverterBase):
@classmethod @classmethod
def _string_common(cls, column, field_args, **extra): def _string_common(cls, column, field_args, **extra):
if column.type.length: if isinstance(column.type.length, int) and column.type.length:
field_args['validators'].append(validators.Length(max=column.type.length)) field_args['validators'].append(validators.Length(max=column.type.length))
@converts('String') # includes VARCHAR, CHAR, and Unicode @converts('String') # includes VARCHAR, CHAR, and Unicode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment