summaryrefslogtreecommitdiff
path: root/ishtar/ishtar_base/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar/ishtar_base/models.py')
-rw-r--r--ishtar/ishtar_base/models.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ishtar/ishtar_base/models.py b/ishtar/ishtar_base/models.py
index 1e9cf9b21..42b79f163 100644
--- a/ishtar/ishtar_base/models.py
+++ b/ishtar/ishtar_base/models.py
@@ -685,6 +685,24 @@ class Operation(BaseHistorizedItem, OwnPerms):
def is_own(self, person):
return False
+
+ @property
+ def surface_ha(self):
+ if self.surface:
+ return self.surface/10000.0
+
+ @property
+ def cost_by_m2(self):
+ if not self.surface or not self.cost:
+ return
+ return round(float(self.cost)/self.surface, 2)
+
+ @property
+ def cost_by_m2(self):
+ if not self.surface or not self.cost:
+ return
+ return round(float(self.cost)/self.surface, 2)
+
@classmethod
def get_query_owns(cls, user):
return Q(in_charge=user.person)|Q(history_modifier=user)\