mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Filter Rigboard context data with new cancelled query parameter
This commit is contained in:
@@ -41,8 +41,13 @@ class RigboardIndex(generic.TemplateView):
|
|||||||
# get super context
|
# get super context
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
objects = models.Event.objects.current_events()
|
||||||
|
|
||||||
|
if self.request.GET.get('hide_cancelled', False):
|
||||||
|
objects = objects.exclude(status=models.Event.CANCELLED)
|
||||||
|
|
||||||
# call out method to get current events
|
# call out method to get current events
|
||||||
context['events'] = models.Event.objects.current_events().select_related('riskassessment', 'invoice').prefetch_related('checklists')
|
context['events'] = objects.select_related('riskassessment', 'invoice').prefetch_related('checklists')
|
||||||
context['page_title'] = "Rigboard"
|
context['page_title'] = "Rigboard"
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user