Opened 7 years ago

Closed 7 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: UI/UX:

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

Download all attachments as: .zip

Change History (3)

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

comment:1 Changed 7 years ago by programmerq

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design 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 7 years ago by jacob

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #5192.

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