From 5d5f3f3626816aeb23778c79bd5a6c15b43aa810 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 23 Oct 2020 15:31:03 +0100 Subject: fixed the order of events on the org detail page --- .../templates/organisations/organisation_detail.html | 12 ++++++++---- ctrack/users/views.py | 7 ++++--- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'ctrack') diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html index cc14860..65a9c03 100644 --- a/ctrack/organisations/templates/organisations/organisation_detail.html +++ b/ctrack/organisations/templates/organisations/organisation_detail.html @@ -187,7 +187,8 @@ Date Description Participants - Comments + Comments + Response Action @@ -217,11 +218,14 @@ NA {% endif %} - {{ event.comments }}
+ {{ event.comments }}
{% if event.document_link %} - Link + [URL] {% endif %} + + {{ event.requested_response_date }} + Edit @@ -285,7 +289,7 @@ {{ event.short_description }} {{ event.comments }}
{% if event.document_link %} - Link + [URL] {% endif %} Edit diff --git a/ctrack/users/views.py b/ctrack/users/views.py index 8924ea8..8f94d85 100644 --- a/ctrack/users/views.py +++ b/ctrack/users/views.py @@ -35,9 +35,9 @@ class UserDetailView(DetailView): context = super().get_context_data() user = self.request.user lead_oes = Organisation.objects.filter(lead_inspector=user).order_by("name") - _single_date_events = SingleDateTimeEvent.objects.filter(user=user).all() - _caf_single_date_events = CAFSingleDateEvent.objects.all() - _caf_twin_date_events = CAFTwinDateEvent.objects.all() + _single_date_events = SingleDateTimeEvent.objects.filter(user=user).order_by("date") + _caf_single_date_events = CAFSingleDateEvent.objects.order_by("date") + _caf_twin_date_events = CAFTwinDateEvent.objects.order_by("date") _combined = list(itertools.chain(_caf_twin_date_events, _caf_single_date_events, _single_date_events)) all_events = sorted(_combined, key=self._comp_dates, reverse=True) for event in all_events: @@ -46,6 +46,7 @@ class UserDetailView(DetailView): setattr(event, "organisation", org) except AttributeError: setattr(event, "organisation", None) + all_events = sorted(_combined, key=self._comp_dates, reverse=True) context["all_events"] = all_events context["lead_oes"] = lead_oes return context -- cgit v1.2.3