Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23480 closed Bug (wontfix)

Length of Verbose_name of models is not checked

Reported by: d9pouces Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The length of the verbose_name is not checked during model validation.
With some backends (PostgreSQL in my case), long verbose_names raise a ValidationError during table creation:

django.core.exceptions.ValidationError: The verbose_name of XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX is longer than 39 characters

I think that could be checked among other model validations.

Change History (5)

comment:1 by Tim Graham, 10 years ago

Validation for verbose_name was added in #18866, could you clarify if something additional is needed (in what cases is the database error raised)?

comment:2 by Tim Graham, 10 years ago

Resolution: needsinfo
Status: newclosed

comment:3 by Shai Berger, 10 years ago

Resolution: needsinfo
Status: closednew

If I understand correctly, the complaint is not about a database error, but about this validation happening only when the permissions are created (that is, when the models are created in the database), rather than as a check in the check framework (which would happen sooner and make fixing easier).

Adding this as a check to django.contrib.auth makes sense to me, but I leave it to people more intimate with django.contrib.auth to accept or reject the ticket.

comment:4 by Aymeric Augustin, 10 years ago

Resolution: wontfix
Status: newclosed

The only point where there's an arbitrary restriction on the length of verbose_name is during the creation of permissions. We should lift that restriction when we start adding migrations to contrib apps. At that point we'll simply stop raising an exception when hitting the limit.

That's why I believe the current level of error reporting is appropriate.

comment:5 by Tim Graham, 10 years ago

Just to close the loop, the max_length of Permission.name was increased to 255 characters in #8162 so the verbose_name limit is effectively 244 characters.

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