diff options
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management/commands/inspectdb.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index 51d7866503..992c523a8e 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -339,7 +339,8 @@ class Command(BaseCommand): # Add max_length for all CharFields. if field_type == "CharField" and row.display_size: - field_params["max_length"] = int(row.display_size) + if (size := int(row.display_size)) and size > 0: + field_params["max_length"] = size if field_type in {"CharField", "TextField"} and row.collation: field_params["db_collation"] = row.collation |
