From 3768f4a61337d0800319a876b0321e4df2897611 Mon Sep 17 00:00:00 2001 From: Arona Date: Sat, 30 May 2020 17:19:11 +0100 Subject: [PATCH] Start RA list template --- RIGS/models.py | 5 + RIGS/rigboard.py | 6 ++ .../.risk_assessment_table.html.kate-swp | Bin 0 -> 61 bytes RIGS/templates/risk_assessment_detail.html | 28 +++--- RIGS/templates/risk_assessment_table.html | 95 ++++++++++++++++++ RIGS/templates/venue_detail.html | 10 +- RIGS/templatetags/filters.py | 5 + RIGS/urls.py | 2 + 8 files changed, 132 insertions(+), 19 deletions(-) create mode 100644 RIGS/templates/.risk_assessment_table.html.kate-swp create mode 100644 RIGS/templates/risk_assessment_table.html diff --git a/RIGS/models.py b/RIGS/models.py index 3fb482df..a1f539db 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -609,6 +609,11 @@ class RiskAssessment(models.Model): # Blimey that was a lot of options + # created = models.DateTimeField(auto_now_add=True) + # reviewed_at = models.DateTimeField() + # reviewed_by = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True, + # verbose_name="Reviewer", on_delete=models.CASCADE) + @property def activity_feed_string(self): return str(self.event) diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 2493a6e7..1603f924 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -439,3 +439,9 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView): }) context['to_name'] = self.request.GET.get('to_name', None) return context + + +class EventRiskAssessmentList(generic.ListView): + paginate_by = 20 + model = models.RiskAssessment + template_name = 'risk_assessment_table.html' diff --git a/RIGS/templates/.risk_assessment_table.html.kate-swp b/RIGS/templates/.risk_assessment_table.html.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..6a7e00230550b0d4ed751ebc735b213397f5cbb2 GIT binary patch literal 61 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn@ncb9%RFnt$TK(I*!1AVo0fd~DZxP? L86Y+WVh2|M#>frI literal 0 HcmV?d00001 diff --git a/RIGS/templates/risk_assessment_detail.html b/RIGS/templates/risk_assessment_detail.html index 166d9865..6f67c973 100644 --- a/RIGS/templates/risk_assessment_detail.html +++ b/RIGS/templates/risk_assessment_detail.html @@ -12,31 +12,31 @@
General
-
{{ object|help_text:'nonstandard_equipment' }}
-
+
{{ object|help_text:'nonstandard_equipment' }}
+
{{ object.nonstandard_equipment|yesno|title }}
-
{{ object|help_text:'nonstandard_use'|safe }}
-
+
{{ object|help_text:'nonstandard_use'|safe }}
+
{{ object.nonstandard_use|yesno|title }}
-
{{ object|help_text:'contractors' }}
-
+
{{ object|help_text:'contractors' }}
+
{{ object.contractors|yesno|title }}
-
{{ object|help_text:'other_companies' }}
-
+
{{ object|help_text:'other_companies' }}
+
{{ object.othercompanies|yesno|title }}
-
{{ object|help_text:'crew_fatigue' }}
-
+
{{ object|help_text:'crew_fatigue' }}
+
{{ object.crewfatigue|yesno|title }}
-
{{ object|help_text:'general_notes' }}
-
+
{{ object|help_text:'general_notes' }}
+
{{ object.general_notes|default:'N/A'|linebreaks }}
-
+
@@ -72,7 +72,7 @@ {{ object.power_notes|default:'N/A'|linebreaks }} -
+
Sound
diff --git a/RIGS/templates/risk_assessment_table.html b/RIGS/templates/risk_assessment_table.html new file mode 100644 index 00000000..4e042206 --- /dev/null +++ b/RIGS/templates/risk_assessment_table.html @@ -0,0 +1,95 @@ +{% extends 'base_rigs.html' %} +{% load paginator from filters %} +{% load help_text from filters %} +{% load verbose_name from filters %} + +{% block title %}Risk Assessment List{% endblock %} + +{% block content %} +
+
+

Risk Assessment List

+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% for object in object_list %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
Event{{ object_list.0|verbose_name:'nonstandard_equipment'|title }}{{ object_list.0|verbose_name:'nonstandard_use'|title }}{{ object_list.0|verbose_name:'contractors'|title }}{{ object_list.0|verbose_name:'other_companies'|title }}{{ object_list.0|verbose_name:'crew_fatigue'|title }}{{ object_list.0|verbose_name:'general_notes'|title }}{{ object_list.0|verbose_name:'big_power'|title }}{{ object_list.0|verbose_name:'power_mic'|title }}{{ object_list.0|verbose_name:'generators'|title }}{{ object_list.0|verbose_name:'other_companies_power'|title }}{{ object_list.0|verbose_name:'nonstandard_equipment_power'|title }}{{ object_list.0|verbose_name:'multiple_electrical_environments'|title }}{{ object_list.0|verbose_name:'power_notes'|title }}{{ object_list.0|verbose_name:'noise_monitoring'|title }}{{ object_list.0|verbose_name:'sound_notes'|title }}{{ object_list.0|verbose_name:'known_venue'|title }}{{ object_list.0|verbose_name:'safe_loading'|title }}{{ object_list.0|verbose_name:'safe_storage'|title }}{{ object_list.0|verbose_name:'area_outside_of_control'|title }}{{ object_list.0|verbose_name:'nonstandard_emergency_procedure'|title }}{{ object_list.0|verbose_name:'barrier_required'|title }}{{ object_list.0|verbose_name:'special_structures'|title }}{{ object_list.0|verbose_name:'persons_responsible_structures'|title }}{{ object_list.0|verbose_name:'suspended_structures'|title }}
{{ object.event }}{{object.nonstandard_equipment|yesno|title}}{{object.nonstandard_use|yesno|title}}{{object.contractors|yesno|title}}{{object.other_companies|yesno|title}}{{object.crew_fatigue|yesno|title}}{{ object.general_notes|default:'N/A'|linebreaks }}{{object.big_power|yesno|title}}{{ object.power_mic.name|default:'N/A' }}{{object.generators|yesno|title}}{{object.other_companies_power|yesno|title}}{{object.nonstandard_equipment_power|yesno|title}}{{object.multiple_electrical_environments|yesno|title}}{{ object.power_notes|default:'N/A'|linebreaks }}{{object.noise_monitoring|yesno|title}}{{ object.sound_notes|default:'N/A'|linebreaks }}{{object.known_venue|yesno|title}}{{object.safe_loading|yesno|title}}{{object.safe_storage|yesno|title}}{{object.area_outside_of_control|yesno|title}}{{object.nonstandard_emergency_procedure|yesno|title}}{{object.barrier_required|yesno|title}}{{object.special_structures|yesno|title}}{{ object.persons_responsible_structures|default:'N/A'|linebreaks }}{{object.suspended_structures|yesno|title}}
Not Found
+
+
+
+ {% if is_paginated %} +
+ {% paginator %} +
+ {% endif %} +{% endblock %} diff --git a/RIGS/templates/venue_detail.html b/RIGS/templates/venue_detail.html index 81d0793a..74f5cc79 100644 --- a/RIGS/templates/venue_detail.html +++ b/RIGS/templates/venue_detail.html @@ -62,8 +62,8 @@
{% include 'partials/last_edited.html' with target="venue_history" %}
@@ -78,10 +78,10 @@
{% include 'partials/last_edited.html' with target="venue_history" %}
diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py index 0ea51bab..03a38a16 100644 --- a/RIGS/templatetags/filters.py +++ b/RIGS/templatetags/filters.py @@ -116,3 +116,8 @@ def orderby(request, field, attr): @register.filter def help_text(obj, field): return obj._meta.get_field(field).help_text + + +@register.filter +def verbose_name(obj, field): + return obj._meta.get_field(field).verbose_name diff --git a/RIGS/urls.py b/RIGS/urls.py index c0076f54..7dd23b44 100644 --- a/RIGS/urls.py +++ b/RIGS/urls.py @@ -99,6 +99,8 @@ urlpatterns = [ name='event_ra_edit'), path('event/ra//history/', permission_required_with_403('RIGS.change_event')(versioning.VersionHistory.as_view()), name='ra_history', kwargs={'model': models.RiskAssessment}), + path('event/ra/list', permission_required_with_403('RIGS.change_event')(rigboard.EventRiskAssessmentList.as_view()), + name='ra_list'), # Finance path('invoice/', permission_required_with_403('RIGS.view_invoice')(finance.InvoiceIndex.as_view()),