Opened 9 years ago

Closed 8 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:


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

Attachments (0)

Change History (3)

comment:1 Changed 9 years ago by Steadicat

  • Cc django@… added

comment:2 Changed 8 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 8 years ago by adrian

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

The model validator catches this.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.