diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 15:31:03 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 15:31:03 +0100 |
commit | 5d5f3f3626816aeb23778c79bd5a6c15b43aa810 (patch) | |
tree | c5ec80a3d6971c33573dcc207b0a81a3a653c4ad | |
parent | 4c7c88f2b1bcc5de54de51fae057d736877e1a6c (diff) |
fixed the order of events on the org detail page
-rw-r--r-- | ctrack/organisations/templates/organisations/organisation_detail.html | 12 | ||||
-rw-r--r-- | ctrack/users/views.py | 7 |
2 files changed, 12 insertions, 7 deletions
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 @@ <th scope="col" class="col-1">Date</th> <th scope="col" class="col-2">Description</th> <th scope="col" class="col-2">Participants</th> - <th scope="col" class="col-4">Comments</th> + <th scope="col" class="col-2">Comments</th> + <th scope="col" class="col-2">Response</th> <th scope="col" class="col-1">Action</th> </tr> </thead> @@ -217,11 +218,14 @@ NA {% endif %} </td> - <td class="col-4">{{ event.comments }}<br> + <td class="col-2">{{ event.comments }}<br> {% if event.document_link %} - <a class="small" href="{{ event.document_link }}">Link</a> + <a class="small" href="{{ event.document_link }}">[URL]</a> {% endif %} </td> + <td class="col-2"> + {{ event.requested_response_date }} + </td> <td class="col-1"><a href="{% url "register:event_update_simple_event_from_org" event.pk object.slug %}" class="btn btn-outline-secondary btn-sm" role="button">Edit</a> @@ -285,7 +289,7 @@ <td class="col-3">{{ event.short_description }}</td> <td class="col-4">{{ event.comments }}<br> {% if event.document_link %} - <a class="small" href="{{ event.document_link }}">Link</a> + <a class="small" href="{{ event.document_link }}">[URL]</a> {% endif %} </td> <td class="col-1"><a href="#" class="btn btn-outline-secondary btn-sm" role="button">Edit</a> 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 |