Opened 12 years ago
Last modified 9 months ago
#19515 assigned Cleanup/optimization
Increase the max_length of Redirect.old_path/new_path
Reported by: | Owned by: | Michael Howitz | |
---|---|---|---|
Component: | contrib.redirects | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | gavinwahl+gh@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
In django.contrib.redirects
the the old_path
and new_path
have max_length=200
. This presents problems when either of the paths has a longer length than 200. URLField
used to have a max_length=200
, but this was resolved [1477] and isn't even applicable, since the path fields use CharField
s, not URLfield
s.
I would recommend a max_length=2000
. URL's with a length over 2000 are not as well supported. However since database enforcement of CharFields in MySQL is limited to 255 characters, the fields have to be also changed to TextField
s.
Change History (15)
comment:1 by , 12 years ago
Keywords: | redirects removed |
---|---|
Owner: | changed from | to
Patch needs improvement: | set |
Status: | new → assigned |
comment:2 by , 12 years ago
Owner: | changed from | to
---|
comment:3 by , 12 years ago
Version: | 1.4 → master |
---|
comment:4 by , 12 years ago
Has patch: | set |
---|
comment:5 by , 12 years ago
Easy pickings: | unset |
---|---|
Triage Stage: | Unreviewed → Someday/Maybe |
Thanks for the suggestion. The problem here isn't to change the max_size — it's to provide a suitable upgrade path for existing users. Otherwise, application-level and database-level constraints won't match any longer, which will result in uncaught errors.
In general we've postponed this kind of requests to after Django gets built-in migrations — most likely 1.6 or 1.7.
(By the way a CharField
is fine. We don't need a textarea
to copy-paste an URL.)
comment:6 by , 12 years ago
Even though we don't need the form provided by a CharField
, MySQL limits unique Charfield
s to 255 characters:
https://docs.djangoproject.com/en/dev/ref/databases/#character-fields
"Any fields that are stored with VARCHAR column types have their max_length restricted to 255 characters if you are using unique=True for the field. This affects CharField, SlugField and CommaSeparatedIntegerField."
comment:7 by , 9 years ago
Summary: | Redirect path fields arbitrarily short → Increase the max_length of Redirect.old_path/new_path |
---|---|
Triage Stage: | Someday/Maybe → Accepted |
comment:11 by , 3 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:12 by , 19 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:13 by , 19 months ago
Patch needs improvement: | unset |
---|
comment:14 by , 19 months ago
Patch needs improvement: | set |
---|
Created fix at https://github.com/saulshanabrook/django/tree/ticket_19515