Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#7257 closed (duplicate)

Flatpage view returns 404 unless url contains trailing slash

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

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 9 years ago.
flatpages.patch (955 bytes) - added by crankycoder@… 8 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 Changed 9 years ago by sean

Owner: changed from nobody to anonymous
Status: newassigned

Changed 9 years ago by sean

Attachment: flatpage_view.diff added

comment:2 Changed 9 years ago by sean

Has patch: set

comment:3 Changed 9 years ago by James Bennett

Resolution: worksforme
Status: assignedclosed

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

comment:4 Changed 8 years ago by crankycoder@…

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.

Changed 8 years ago by crankycoder@…

Attachment: flatpages.patch added

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

comment:5 Changed 8 years ago by anonymous

milestone: 1.0 beta

comment:6 Changed 8 years ago by shawnr

Owner: changed from anonymous to shawnr
Status: reopenednew

comment:7 Changed 8 years ago by shawnr

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 Changed 8 years ago by shawnr

Owner: shawnr deleted

comment:9 Changed 8 years ago by anonymous

looks like a duplicate of #6213...

comment:10 Changed 8 years ago by anonymous

Resolution: duplicate
Status: newclosed

comment:11 Changed 5 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

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