Ongoing development of "Things"
Some checks failed
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 2m52s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 25s
SonarQube Scan / SonarQube Trigger (push) Failing after 20s

This commit is contained in:
2025-12-28 20:49:23 +01:00
parent c3168c32cf
commit 23ede15938
7 changed files with 297 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
class BoxType(models.Model):
@@ -37,13 +38,20 @@ class Box(models.Model):
return self.id
class ThingType(models.Model):
"""A type/category for things stored in boxes."""
class ThingType(MPTTModel):
"""A hierarchical type/category for things stored in boxes."""
name = models.CharField(max_length=255, unique=True)
name = models.CharField(max_length=255)
parent = TreeForeignKey(
'self',
on_delete=models.CASCADE,
null=True,
blank=True,
related_name='children'
)
class Meta:
ordering = ['name']
class MPTTMeta:
order_insertion_by = ['name']
def __str__(self):
return self.name