mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-30 11:52:17 +00:00
Formatting...
This commit is contained in:
@@ -80,7 +80,7 @@ class EventRiskAssessmentList(generic.ListView):
|
|||||||
context['edit'] = 'ra_edit'
|
context['edit'] = 'ra_edit'
|
||||||
context['review'] = 'ra_review'
|
context['review'] = 'ra_review'
|
||||||
context['perm'] = 'perms.RIGS.review_riskassessment'
|
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
|
return context
|
||||||
|
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ class EventChecklistList(generic.ListView):
|
|||||||
context['edit'] = 'ec_edit'
|
context['edit'] = 'ec_edit'
|
||||||
context['review'] = 'ec_review'
|
context['review'] = 'ec_review'
|
||||||
context['perm'] = 'perms.RIGS.review_eventchecklist'
|
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
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -443,7 +443,6 @@ class Event(models.Model, RevisionMixin):
|
|||||||
else:
|
else:
|
||||||
return endDate
|
return endDate
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def internal(self):
|
def internal(self):
|
||||||
return bool(self.organisation and self.organisation.union_account)
|
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,
|
reviewed_by = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True,
|
||||||
verbose_name="Reviewer", on_delete=models.CASCADE)
|
verbose_name="Reviewer", on_delete=models.CASCADE)
|
||||||
|
|
||||||
inverted_fields = ['nonstandard_equipment','nonstandard_use', 'contractors', 'other_companies', 'crew_fatigue', 'big_power',
|
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'
|
'generators', 'other_companies_power', 'nonstandard_equipment_power', 'multiple_electrical_environments', 'noise_monitoring'
|
||||||
'special_structures', 'suspended_structures']
|
'special_structures', 'suspended_structures']
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['event']
|
ordering = ['event']
|
||||||
|
|||||||
@@ -122,12 +122,13 @@ def orderby(request, field, attr):
|
|||||||
@register.filter(needs_autoescape=True)
|
@register.filter(needs_autoescape=True)
|
||||||
def get_field(obj, field, autoescape=True):
|
def get_field(obj, field, autoescape=True):
|
||||||
value = getattr(obj, field)
|
value = getattr(obj, field)
|
||||||
if(type(value)==bool):
|
if(isinstance(value, bool)):
|
||||||
value = yesnoi(value, field in obj.inverted_fields)
|
value = yesnoi(value, field in obj.inverted_fields)
|
||||||
elif(type(value)==str):
|
elif(isinstance(value, str)):
|
||||||
value = truncatewords(value, 20)
|
value = truncatewords(value, 20)
|
||||||
return mark_safe(value)
|
return mark_safe(value)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def help_text(obj, field):
|
def help_text(obj, field):
|
||||||
if hasattr(obj, '_meta'):
|
if hasattr(obj, '_meta'):
|
||||||
@@ -139,6 +140,7 @@ def verbose_name(obj, field):
|
|||||||
if hasattr(obj._meta.get_field(field), 'verbose_name'):
|
if hasattr(obj._meta.get_field(field), 'verbose_name'):
|
||||||
return obj._meta.get_field(field).verbose_name
|
return obj._meta.get_field(field).verbose_name
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def get_list(dictionary, key):
|
def get_list(dictionary, key):
|
||||||
return dictionary.getlist(key)
|
return dictionary.getlist(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user