diff --git a/RIGS/hs.py b/RIGS/hs.py index 19f6ed71..31343c6e 100644 --- a/RIGS/hs.py +++ b/RIGS/hs.py @@ -80,7 +80,7 @@ class EventRiskAssessmentList(generic.ListView): context['edit'] = 'ra_edit' context['review'] = 'ra_review' context['perm'] = 'perms.RIGS.review_riskassessment' - context['fields'] = [n.name for n in list(self.model._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created ] + context['fields'] = [n.name for n in list(self.model._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created] return context @@ -169,7 +169,7 @@ class EventChecklistList(generic.ListView): context['edit'] = 'ec_edit' context['review'] = 'ec_review' context['perm'] = 'perms.RIGS.review_eventchecklist' - context['fields'] = [n.name for n in list(self.model._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created ] + context['fields'] = [n.name for n in list(self.model._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created] return context diff --git a/RIGS/models.py b/RIGS/models.py index ca97f9bc..be16a8ae 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -443,7 +443,6 @@ class Event(models.Model, RevisionMixin): else: return endDate - @property def internal(self): return bool(self.organisation and self.organisation.union_account) @@ -631,9 +630,9 @@ class RiskAssessment(models.Model, RevisionMixin): reviewed_by = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True, verbose_name="Reviewer", on_delete=models.CASCADE) - inverted_fields = ['nonstandard_equipment','nonstandard_use', 'contractors', 'other_companies', 'crew_fatigue', 'big_power', - 'generators', 'other_companies_power', 'nonstandard_equipment_power','multiple_electrical_environments','noise_monitoring' - 'special_structures', 'suspended_structures'] + inverted_fields = ['nonstandard_equipment', 'nonstandard_use', 'contractors', 'other_companies', 'crew_fatigue', 'big_power', + 'generators', 'other_companies_power', 'nonstandard_equipment_power', 'multiple_electrical_environments', 'noise_monitoring' + 'special_structures', 'suspended_structures'] class Meta: ordering = ['event'] diff --git a/RIGS/templatetags/filters.py b/RIGS/templatetags/filters.py index 2ded1c56..23af7a0e 100644 --- a/RIGS/templatetags/filters.py +++ b/RIGS/templatetags/filters.py @@ -122,12 +122,13 @@ def orderby(request, field, attr): @register.filter(needs_autoescape=True) def get_field(obj, field, autoescape=True): value = getattr(obj, field) - if(type(value)==bool): + if(isinstance(value, bool)): value = yesnoi(value, field in obj.inverted_fields) - elif(type(value)==str): + elif(isinstance(value, str)): value = truncatewords(value, 20) return mark_safe(value) + @register.filter def help_text(obj, field): if hasattr(obj, '_meta'): @@ -139,6 +140,7 @@ def verbose_name(obj, field): if hasattr(obj._meta.get_field(field), 'verbose_name'): return obj._meta.get_field(field).verbose_name + @register.filter def get_list(dictionary, key): return dictionary.getlist(key)