#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)
Change History (13)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 17 years ago
Attachment: | flatpage_view.diff added |
---|
comment:2 by , 17 years ago
Has patch: | set |
---|
comment:3 by , 17 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
comment:4 by , 16 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
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 , 16 years ago
Attachment: | flatpages.patch added |
---|
flatpages patch to force redirects if APPEND_SLASH is enabled in settings.py
comment:5 by , 16 years ago
milestone: | → 1.0 beta |
---|
comment:6 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:7 by , 16 years ago
Triage Stage: | Unreviewed → Ready 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 , 16 years ago
Owner: | removed |
---|
comment:10 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Feels like you want to turn on
CommonMiddleware
andAPPEND_SLASH
, which are both on by default.