From 6d2cd94729a20904d5970b895e686af40353868e Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 21 Oct 2020 14:31:41 +0100 Subject: adding the form for caf single date event --- ctrack/caf/templates/caf/caf_detail.html | 111 +++++++++++++++++++++---------- ctrack/caf/views.py | 5 ++ 2 files changed, 81 insertions(+), 35 deletions(-) (limited to 'ctrack/caf') diff --git a/ctrack/caf/templates/caf/caf_detail.html b/ctrack/caf/templates/caf/caf_detail.html index adda474..3a73beb 100644 --- a/ctrack/caf/templates/caf/caf_detail.html +++ b/ctrack/caf/templates/caf/caf_detail.html @@ -58,11 +58,11 @@
-
CAF Basic Information
+
Basic Information
- +
- + @@ -100,20 +100,90 @@ + +
+
+
+
+
CAF History
+
+ + + + + New Single Date Event | + + + + + New Period Event +
+ +
+
OrganisationOrganisation {{ organisation }}
+ + + + + + + + + + + {% for event in all_events %} + + + + + + + + {% endfor %} + +
DateEventInspectorDescriptionComments
{{ event.date }}{{ event.type_descriptor }}{{ event.user.name }}{{ event.short_description }}{{ event.comments }}
+ + + {#
#} + {# {% for event in single_date_events %}#} + {#
#} + {#
#} + {#

{{ event.date|date:"j F Y" }}

#} + {# {{ event.type }}#} + {#
#} + {# {% if event.comments%}#} + {#

{{ event.comments }}
#} + {# (Inspector: {{ event.user }})#} + {#

#} + {# {% else %}#} + {#

No comments made.

#} + {# {% endif %}#} + {#
#} + {# {% endfor %}#} + {#
#} +
+
+
+
+
-
- +
{% if systems|length > 0 %} {% for system in systems %} - +
{{ system.name }}{{ system.name }} {{ system.function }}
{{ system.caf }} @@ -132,36 +202,7 @@ -
-
-
-
- -
- {% for event in object.get_events %} -
-
-

{{ event.date|date:"j F Y" }}

- {{ event.type }} -
- {% if event.comments%} -

{{ event.comments }}
- (Inspector: {{ event.user }}) -

- {% else %} -

No comments made.

- {% endif %} -
- {% endfor %} -
-
-
-
-
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index a5d9953..e8479ab 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -1,3 +1,5 @@ +import itertools + from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin from django.http import HttpResponseRedirect @@ -24,6 +26,8 @@ def caf_detail_view(request, pk): assessments = caf.cafassessment_set.all() # caf_principles = CAFPrinciple.objects.all() _scrs = [] + _events = list(itertools.chain(caf.cafsingledateevent_set.all(), caf.caftwindateevent_set.all())) + all_events = sorted(_events, key=lambda x: x.date, reverse=True) for ass in assessments: lst_scores = [ass, CAFAssessmentOutcomeScore.objects.filter(caf_assessment=ass)] _scrs.append(lst_scores) @@ -34,6 +38,7 @@ def caf_detail_view(request, pk): "systems": caf.systems.all(), "single_date_events": caf.cafsingledateevent_set.all(), "twin_date_events": caf.caftwindateevent_set.all(), + "all_events": all_events, } return render(request, "caf/caf_detail.html", context) -- cgit v1.2.3