#199 closed defect (fixed)
CharField should raise an exception when maxlength is not specified
Reported by: | Steadicat | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Metasystem | Version: | |
Severity: | trivial | Keywords: | |
Cc: | django@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
"maxlength" is a required keyword argument for a CharField, yet no error is raised if the argument is not provided.
The error produces its effect much later when the SQL code containing "varchar(None)" fails.
It would be better for CharField to raise an exception immediately, so as to simplify debugging.
Change History (3)
comment:1 by , 19 years ago
Cc: | added |
---|
comment:2 by , 19 years ago
comment:3 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The model validator catches this.
Note:
See TracTickets
for help on using tickets.
An alternative would be to create only "varchar" fields (without length defined), as it is supported with at least sqlite and postgresql. That way one could make use of the PostgreSQL unbound varchars - you can for example index them (you can't index text fields).