You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_django/common/models.py

42 lines
1.1 KiB
Python

from django.db import models
# Create your models here.
class NomenclatureBaseModel(models.Model):
name = models.CharField(max_length=100, unique=True)
short_name = models.CharField(max_length=5, unique=True)
description = models.TextField(blank=True, null=True)
class Meta:
abstract = True
ordering = ['name']
def __str__(self):
return self.name
class PayerModel(NomenclatureBaseModel):
...
class LinesModel(NomenclatureBaseModel):
payer = models.ForeignKey(
PayerModel,
on_delete=models.CASCADE,
related_name='line_payers'
)
class OperationModel(NomenclatureBaseModel):
...
class ContainerKindModel(NomenclatureBaseModel):
...
class ContainerTypeModel(models.Model):
name = models.CharField(max_length=6, unique=True)
length = models.IntegerField()
height = models.BooleanField()
container_type = models.ForeignKey(
ContainerKindModel,
on_delete=models.CASCADE,
related_name='container_type_container_kinds'
)
deleted = models.BooleanField(default=False)