Ticket #6932: flatpages_list.diff

File flatpages_list.diff, 1003 bytes (added by Dmitri Fedortchenko <zeraien@…>, 17 years ago)

Put a list of flatpages into the context.

  • django/contrib/flatpages/views.py

     
    2222    if not url.startswith('/'):
    2323        url = "/" + url
    2424    f = get_object_or_404(FlatPage, url__exact=url, sites__id__exact=settings.SITE_ID)
     25   
     26    flatpages = FlatPage.objects.filter(sites__id__exact=settings.SITE_ID)
     27    if not request.user.is_authenticated():
     28        flatpages = flatpages.filter(registration_required=False)
     29       
    2530    # If registration is required for accessing this page, and the user isn't
    2631    # logged in, redirect to the login page.
    2732    if f.registration_required and not request.user.is_authenticated():
     
    4045
    4146    c = RequestContext(request, {
    4247        'flatpage': f,
     48        'flatpages': flatpages,
    4349    })
    4450    response = HttpResponse(t.render(c))
    4551    populate_xheaders(request, response, FlatPage, f.id)
Back to Top