Free and open source ticket system written in python
1from django.shortcuts import render
2from django.views.generic import ListView
3from .models import Incident
4
5
6class IncidentListView(ListView):
7 model = Incident
8
9 def get_context_data(self, **kwargs):
10 context = super().get_context_data(**kwargs)
11 context["existing_incidents"] = Incident.objects.filter(public=True, resolved=False).exists()
12 return context
13
14 def get_queryset(self):
15 return Incident.objects.filter(public=True).order_by('resolved')