Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#7257 closed (duplicate)

Flatpage view returns 404 unless url contains trailing slash

Reported by: sean Owned by:
Component: Contrib apps Version: dev
Severity: Keywords: flatpages
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The admin interface for flatpages instructs user to use a trailing slash for the flatpage url. However, if an attempt to access the flatpage without the trailing slash is made, a 404 error is returned instead of the flatpage.

Attachments (2)

flatpage_view.diff (411 bytes ) - added by sean 16 years ago.
flatpages.patch (955 bytes ) - added by crankycoder@… 16 years ago.
flatpages patch to force redirects if APPEND_SLASH is enabled in settings.py

Download all attachments as: .zip

Change History (13)

comment:1 by sean, 16 years ago

Owner: changed from nobody to anonymous
Status: newassigned

by sean, 16 years ago

Attachment: flatpage_view.diff added

comment:2 by sean, 16 years ago

Has patch: set

comment:3 by James Bennett, 16 years ago

Resolution: worksforme
Status: assignedclosed

Feels like you want to turn on CommonMiddleware and APPEND_SLASH, which are both on by default.

comment:4 by crankycoder@…, 16 years ago

Resolution: worksforme
Status: closedreopened

This doesn't work in django trunk (r7877) and I have CommonMiddleware and APPEND_SLASH=True.

This seems to be because of the way CommonMiddleware detects if a URL already exists - it looks up URLs in urlresolvers.

As FlatPages doesn't talk to urlresolvers - no page in FlatPages will ever resolve.

The attached patch (flatpages.patch) forces a redirect since I don't like the idea of automatically adding new URLs that will respond to requests.

by crankycoder@…, 16 years ago

Attachment: flatpages.patch added

flatpages patch to force redirects if APPEND_SLASH is enabled in settings.py

comment:5 by anonymous, 16 years ago

milestone: 1.0 beta

comment:6 by shawnr, 16 years ago

Owner: changed from anonymous to shawnr
Status: reopenednew

comment:7 by shawnr, 16 years ago

Triage Stage: UnreviewedReady for checkin

Malcolm looked over my shoulder and we walked through some tests. It seems to behave properly, so this patch looks good.

comment:8 by shawnr, 16 years ago

Owner: shawnr removed

comment:9 by anonymous, 16 years ago

looks like a duplicate of #6213...

comment:10 by anonymous, 16 years ago

Resolution: duplicate
Status: newclosed

comment:11 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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