summaryrefslogtreecommitdiff
path: root/app/fieldnotes/views.py
blob: fefd138ac6916e064cf10aa5f894e3e3139ab509 (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
from django.views.generic.dates import YearArchiveView, MonthArchiveView
from django.views.generic.detail import DetailView

from utils.views import PaginatedListView

from .models import FieldNote


class FieldNoteListView(PaginatedListView):
    """
    Return a list of Notes in reverse chronological order
    """
    queryset = FieldNote.objects.filter(status=1).order_by('-pub_date')


class FieldNoteDetailView(DetailView):
    model = FieldNote
    slug_field = "slug"


class FieldNoteDetailViewTXT(FieldNoteDetailView):
    template_name = "jrnl/entry.txt"


class FieldNoteYearArchiveView(YearArchiveView):
    queryset = FieldNote.objects.filter(status=1)
    date_field = "pub_date"
    template_name = "fieldnotes/fieldnote_archive_list_date.html"
    make_object_list = True


class FieldNoteMonthArchiveView(MonthArchiveView):
    queryset = FieldNote.objects.filter(status=1)
    date_field = "pub_date"
    make_object_list = True
    template_name = "fieldnotes/fieldnote_archive_list_date.html"