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

46 lines
1.2 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, null=True, blank=True)
description = models.TextField(blank=True, null=True)
class Meta:
abstract = True
ordering = ['name']
def __str__(self):
return self.name
class CompanyModel(NomenclatureBaseModel):
...
class LinesModel(NomenclatureBaseModel):
company = models.ForeignKey(
'common.CompanyModel',
on_delete=models.CASCADE,
related_name='line_company'
)
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(
'common.ContainerKindModel',
on_delete=models.CASCADE,
related_name='container_type_container_kinds'
)
deleted = models.BooleanField(default=False)
def __str__(self):
return self.name