Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #6213: flatpage view now correctly redirects if settings.APPEND…

…_SLASH. Thanks, crankycoder.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d0f57e7c7385a112cb9e19d314352fc5ed5b0747 1 parent 98d8acf
@jacobian jacobian authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/contrib/flatpages/views.py
View
4 django/contrib/flatpages/views.py
@@ -1,7 +1,7 @@
from django.contrib.flatpages.models import FlatPage
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
-from django.http import HttpResponse
+from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.safestring import mark_safe
@@ -19,6 +19,8 @@ def flatpage(request, url):
flatpage
`flatpages.flatpages` object
"""
+ if not url.endswith('/') and settings.APPEND_SLASH:
+ return HttpResponseRedirect(url + "/")
if not url.startswith('/'):
url = "/" + url
f = get_object_or_404(FlatPage, url__exact=url, sites__id__exact=settings.SITE_ID)
Please sign in to comment.
Something went wrong with that request. Please try again.