Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#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 Steadicat, 19 years ago

Cc: django@… added

comment:2 by hugo, 19 years ago

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).

comment:3 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

The model validator catches this.

Note: See TracTickets for help on using tickets.
Back to Top