summaryrefslogtreecommitdiff
path: root/app/resume/views.py
blob: 7e5de14a30982928082273d569c8cf69759b47e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from django.views.generic.detail import DetailView
from django.views.generic.base import TemplateView
from utils.views import PaginatedListView

from .models import PubItem, Publisher
from pages.models import Page


class PublisherListView(PaginatedListView):
    template_name = 'archives/resume-pubs.html'

    def get_queryset(self):
        return PubItem.objects.all()

    def get_context_data(self, **kwargs):
        # Call the base implementation first to get a context
        context = super(PublisherListView, self).get_context_data(**kwargs)
        context['pub_list'] = Publisher.objects.all()
        return context


class PubItemDetailView(DetailView):
    model = PubItem
    template_name = "details/resume.html"
    slug_field = "slug"


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

    def get_queryset(self):
        return Page.objects.filter(path__startswith=self.kwargs['slug'])

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


class BaseView(TemplateView):
    template_name = "archives/resume.html"