summaryrefslogtreecommitdiff
path: root/app/pages/views.py
blob: 026ab36b314f7f76bd72d1446aab65411ad1d142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from pages.models import Page

def page(request, slug):
    obj = get_object_or_404(Page, slug__exact=slug)
    context = {'object': obj, }
    return render_to_response(["details/%s.html" % obj.slug, 'details/page.html'], context, context_instance=RequestContext(request))

from django.views.generic.detail import DetailView


class PageDetailView(DetailView):
    model = Page
    slug_field = "slug"

    def get_template_names(self):
        obj = self.get_object()
        return ["details/%s.html" % obj.slug, 'details/page.html']