summaryrefslogtreecommitdiff
path: root/app/posts/views/field_note_views.py
blob: 15ce3ffef048e6329120ed9e278c4427ecc3d5d9 (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
41
42
43
44
45
46
47
48
from django.views.generic.dates import YearArchiveView, MonthArchiveView
from django.views.generic.detail import DetailView

from utils.views import PaginatedListView, LuxDetailView

from ..models import Post, PostType


class FieldNoteListView(PaginatedListView):
    model = Post
    template_name = "posts/fieldnote_list.html"
    """
    Return a list of Notes in reverse chronological order
    """
    queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1).order_by('-pub_date')
    
    def get_context_data(self, **kwargs):
        '''
        Add breadcrumb path 
        '''
        context = super(FieldNoteListView, self).get_context_data(**kwargs)
        context['breadcrumbs'] = ("field notes",)
        return context


class FieldNoteDetailView(LuxDetailView):
    model = Post
    slug_field = "slug"
    template_name = "posts/fieldnote_detail.html"


class FieldNoteDetailViewTXT(FieldNoteDetailView):
    template_name = "posts/jrnl_detail.txt"


class FieldNoteYearArchiveView(YearArchiveView):
    queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1)
    date_field = "pub_date"
    template_name = "posts/fieldnote_archive_list_date.html"
    make_object_list = True


class FieldNoteMonthArchiveView(MonthArchiveView):
    queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1)
    date_field = "pub_date"
    make_object_list = True
    template_name = "posts/fieldnote_archive_list_date.html"