From a950b941caa90793b6a3d5a7251314f3e8aa4c1f Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Thu, 15 Oct 2020 14:51:24 +0100 Subject: [PATCH] Move status color logic back to template Cause that somehow makes it work better?? --- RIGS/models.py | 21 ++++----------------- RIGS/templates/partials/event_table.html | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/RIGS/models.py b/RIGS/models.py index bfbc4487..b1917159 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -379,13 +379,6 @@ class Event(models.Model, RevisionMixin): def confirmed(self): return (self.status == self.BOOKED or self.status == self.CONFIRMED) - @property - def authorised(self): - if self.internal: - return self.authorisation.amount == self.total - else: - return bool(self.purchase_order) - @property def hs_done(self): return self.riskassessment is not None and len(self.checklists.all()) > 0 @@ -455,17 +448,11 @@ class Event(models.Model, RevisionMixin): return bool(self.organisation and self.organisation.union_account) @property - def status_color(self): - if self.cancelled: - return "table-secondary" - elif not self.is_rig: - return "table-info" - elif not self.mic: - return "table-danger" - elif self.confirmed and self.authorised and (self.dry_hire or self.riskassessment): - return "table-success" + def authorised(self): + if self.internal: + return self.authorisation.amount == self.total else: - return "table-warning" + return bool(self.purchase_order) objects = EventManager() diff --git a/RIGS/templates/partials/event_table.html b/RIGS/templates/partials/event_table.html index 94d3c226..7b15b794 100644 --- a/RIGS/templates/partials/event_table.html +++ b/RIGS/templates/partials/event_table.html @@ -11,7 +11,21 @@ {% for event in events %} - + {{ event.display_id }}