Opened 16 years ago

Closed 16 years ago

#7663 closed (duplicate)

flatpages doesnt like url="foo.html"

Reported by: Carl Karsten <carl@…> Owned by: nobody
Component: Contrib apps Version: dev
Severity: Keywords: flatpage
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I needed to convert a site of static .html pages into flatpages, but couldn't because I needed the URLs to end in .html, but the dot causes isAlphaNumericURL to reject it. I took it out, and all is well, except that I now have hacked code that I have to deal with.

http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/models.py#L8

class FlatPage(models.Model):

url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True,

help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))

It might be better to tune the validation, but I am not sure it is worth the effort.

Attachments (1)

flatpages.diff (651 bytes ) - added by Carl Karsten <carl@…> 16 years ago.

Download all attachments as: .zip

Change History (3)

by Carl Karsten <carl@…>, 16 years ago

Attachment: flatpages.diff added

comment:1 by Jeff Anderson, 16 years ago

Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed

There might be a reason that the validator is there. I think it should be fine to be able to put a '.html' for a flatpage-- it's in harmony with the 'cruft-free' URL philosophy that django makes possible.

Instead of taking out the validator, why not write one that allows dots, but not other characters that could cause problems.

comment:2 by Jacob, 16 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #5192.

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