Beispiel #1
0
def render_flatpage(request, f):
    """
    Internal interface to the flat page view.
    """
    # If registration is required for accessing this page, and the user isn't
    # logged in, redirect to the login page.
    if f.registration_required and not request.user.is_authenticated():
        from django.contrib.auth.views import redirect_to_login
        return redirect_to_login(request.path)
    if f.template_name:
        t = loader.select_template((f.template_name, DEFAULT_TEMPLATE))
    else:
        t = loader.get_template(DEFAULT_TEMPLATE)

    # To avoid having to always use the "|safe" filter in flatpage templates,
    # mark the title and content as already safe (since they are raw HTML
    # content in the first place).
    f.title = mark_safe(f.title)
    f.content = mark_safe(f.content)
    data = {
        'flatpage': f,        
    }
    data.update(get_initial_data())
    c = RequestContext(request, data)
    response = HttpResponse(t.render(c))
    populate_xheaders(request, response, FlatPage, f.id)
    return response
Beispiel #2
0
 def get_context_data(self, **kwargs):
     context = super(AlbumDetailView, self).get_context_data(**kwargs)
     context.update(get_initial_data())
     return context
Beispiel #3
0
 def get_context_data(self, **kwargs):
     context = super(CategoryListView, self).get_context_data(**kwargs)
     context.update(get_initial_data())
     return context
Beispiel #4
0
 def get_context_data(self, **kwargs):
     context = super(AlbumListView, self).get_context_data(**kwargs)
     context['taggs'] = self.kwargs.get('tags', False)
     context['category'] = self.kwargs.get('category', False)
     context.update(get_initial_data())
     return context