Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#199 closed defect (fixed)

CharField should raise an exception when maxlength is not specified

Reported by: Steadicat Owned by: adrian
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: UI/UX:

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 Changed 10 years ago by Steadicat

  • Cc django@… added

comment:2 Changed 9 years ago by hugo

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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

The model validator catches this.

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