diff options
Diffstat (limited to 'archaeological_files')
-rw-r--r-- | archaeological_files/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 5e586aa28..e753908f9 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -19,6 +19,7 @@ import datetime from collections import OrderedDict +import json from django.apps import apps from django.conf import settings @@ -1755,6 +1756,19 @@ class PreventiveFileEquipmentServiceCost(models.Model): verbose_name_plural = _("Equipment requirements") ADMIN_SECTION = _("Preventive") + def toJSON(self): + return json.dumps({ + "file": str(self.file), + "equipment_service_cost": str(self.equipment_service_cost), + "quantity_by_day_planned": self.quantity_by_day_planned, + "days_planned": self.days_planned, + "quantity_by_day_worked": self.quantity_by_day_worked, + "days_worked": self.days_worked, + }, + sort_keys=True, + indent=4 + ) + @property def quantity_planned(self): if self.equipment_service_cost.flat_rate: |