summaryrefslogtreecommitdiff
path: root/archaeological_files/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-07-22 18:22:54 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:47 +0200
commit6a5acdc166566bdbd2e09bbf5e2f1c5c40561802 (patch)
tree3baeabba234b84ff9ad82e5513ce70e63bd5a3f2 /archaeological_files/models.py
parentc3d97de7bdec3f7899340c606f46276836eb2a8b (diff)
downloadIshtar-6a5acdc166566bdbd2e09bbf5e2f1c5c40561802.tar.bz2
Ishtar-6a5acdc166566bdbd2e09bbf5e2f1c5c40561802.zip
Preventive file: work on inlines - 2
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r--archaeological_files/models.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 334e8faa4..ab84be8cb 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -104,15 +104,6 @@ class EquipmentServiceType(GeneralType):
generic_equipment_type = models.ForeignKey(
GenericEquipmentServiceType, verbose_name=_("Generic type"))
order = models.IntegerField(_("Order"), default=10)
- parent = models.ForeignKey(
- "self",
- blank=True,
- null=True,
- on_delete=models.CASCADE,
- verbose_name=_("Parent"),
- help_text=_("Auto-add this cost when a parent is added"),
- related_name="children"
- )
class Meta:
verbose_name = _("Equipment/service type")
@@ -131,6 +122,16 @@ ES_UNITS = (
class EquipmentServiceCost(models.Model):
equipment_service_type = models.ForeignKey(
EquipmentServiceType, verbose_name=_("Equipment/Service"))
+ slug = models.SlugField(
+ _("Textual ID"),
+ unique=True,
+ max_length=300,
+ help_text=_(
+ "The slug is the standardized version of the name. It contains "
+ "only lowercase letters, numbers and hyphens. Each slug must "
+ "be unique."
+ ),
+ )
service_provider = models.CharField(
_("Service provider"), max_length=200, blank=True, default="")
flat_rate = models.BooleanField(_("Flat rate"), default=False)
@@ -141,6 +142,15 @@ class EquipmentServiceCost(models.Model):
max_length=200, default="")
order = models.IntegerField(_("Order"), default=10)
available = models.BooleanField(_("Available"), default=True)
+ parent = models.ForeignKey(
+ EquipmentServiceType,
+ blank=True,
+ null=True,
+ on_delete=models.CASCADE,
+ verbose_name=_("Parent"),
+ help_text=_("Auto-add this cost when a parent is added"),
+ related_name="children"
+ )
class Meta:
verbose_name = _("Equipment/service cost")
@@ -148,7 +158,10 @@ class EquipmentServiceCost(models.Model):
ordering = ("order", "equipment_service_type__label",)
def __str__(self):
- lbl = str(self.equipment_service_type)
+ lbl = ""
+ if self.parent:
+ lbl = self.parent.label + " - "
+ lbl += str(self.equipment_service_type)
if self.specificity:
lbl += " - " + self.specificity
if self.service_provider: