Opened 12 years ago

Last modified 8 months ago

#19515 assigned Cleanup/optimization

Increase the max_length of Redirect.old_path/new_path

Reported by: s.shanabrook@… 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 CharFields, not URLfields.

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

Change History (15)

comment:1 by Saul Shanabrook <s.shanabrook@…>, 12 years ago

Keywords: redirects removed
Owner: changed from nobody to anonymous
Patch needs improvement: set
Status: newassigned

comment:2 by Saul Shanabrook, 12 years ago

Owner: changed from anonymous to Saul Shanabrook

comment:3 by Saul Shanabrook, 12 years ago

Version: 1.4master

comment:5 by Aymeric Augustin, 12 years ago

Easy pickings: unset
Triage Stage: UnreviewedSomeday/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.)

Last edited 12 years ago by Aymeric Augustin (previous) (diff)

comment:6 by s.shanabrook@…, 12 years ago

Even though we don't need the form provided by a CharField, MySQL limits unique Charfields 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 Tim Graham, 9 years ago

Summary: Redirect path fields arbitrarily shortIncrease the max_length of Redirect.old_path/new_path
Triage Stage: Someday/MaybeAccepted

comment:8 by Gavin Wahl, 9 years ago

Cc: gavinwahl+gh@… added

Django now has built-in migrations. Is this feasible now?

comment:9 by Tim Graham, 9 years ago

I'd think so (hence why I moved the ticket to accepted).

comment:10 by Claude Paroz, 7 years ago

This will be far easier once #28661 is fixed.

comment:11 by Mariusz Felisiak, 3 years ago

Owner: Saul Shanabrook removed
Status: assignednew

comment:12 by Michael Howitz, 17 months ago

Owner: set to Michael Howitz
Status: newassigned

comment:13 by Michael Howitz, 17 months ago

Patch needs improvement: unset

comment:14 by Mariusz Felisiak, 17 months ago

Patch needs improvement: set

comment:15 by Mariusz Felisiak, 8 months ago

Blocked by #28661.

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