Ticket #6309: apped_slash_flatpages.diff
File apped_slash_flatpages.diff, 1.7 KB (added by , 17 years ago) |
---|
-
django/contrib/flatpages/views.py
1 1 from django.contrib.flatpages.models import FlatPage 2 2 from django.template import loader, RequestContext 3 3 from django.shortcuts import get_object_or_404 4 from django.http import HttpResponse 4 from django.http import HttpResponse, HttpResponseRedirect 5 5 from django.conf import settings 6 6 from django.core.xheaders import populate_xheaders 7 7 from django.utils.safestring import mark_safe … … 21 21 """ 22 22 if not url.startswith('/'): 23 23 url = "/" + url 24 # if APPEND_SLASH=True, will not serve flatpage without a slash 25 if settings.APPEND_SLASH and not url.endswith('/'): 26 return HttpResponseRedirect(url + "/") 27 24 28 f = get_object_or_404(FlatPage, url__exact=url, sites__id__exact=settings.SITE_ID) 25 29 # If registration is required for accessing this page, and the user isn't 26 30 # logged in, redirect to the login page. -
docs/flatpages.txt
63 63 64 64 For more on middleware, read the `middleware docs`_. 65 65 66 **New in Django development version** 67 68 .. admonition:: Flatpages and ``APPEND_SLASH`` 69 70 If you use flatpages with ``APPEND_SLASH`` setting turned on, Django will 71 always append slashshes to flatpage URLs, too. 72 66 73 .. _SITE_ID: ../settings/#site-id 67 74 .. _RequestContext: ../templates_python/#subclassing-context-djangocontext 68 75 .. _middleware docs: ../middleware/