Opened 11 years ago

Closed 11 years ago

#7663 closed (duplicate)

flatpages doesnt like url="foo.html"

Reported by: Carl Karsten <carl@…> Owned by: nobody
Component: Contrib apps Version: master
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


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.

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@…> 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Carl Karsten <carl@…>

Attachment: flatpages.diff added

comment:1 Changed 11 years ago by Jeff Anderson

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 Changed 11 years ago by Jacob

Resolution: duplicate
Status: newclosed

Duplicate of #5192.

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