aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/views.py
blob: c90cb76b9df9f31956f7433f3c5e54f07ea97545 (plain) (blame)
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 import CreateView, ListView

from ctrack.caf.forms import CAFForm
from ctrack.caf.models import ApplicableSystem


class CreateCAF(CreateView):
    form_class = CAFForm
    template_name = "caf/create.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['form'] = self.form_class
        return context


class ListCAF(ListView):
    pass


class ListApplicableSystem(ListView):
    model = ApplicableSystem

    # TODO - add primary_nis_contact tick to the context
    #    Context can be easily found with:
    #    org.person_set.filter(primary_nis_contact=True) or similar

    def get_queryset(self):
        ess = ApplicableSystem.objects.all().order_by("organisation__name")
        return ess

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        return context