mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Formatting...
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user