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.

29 lines
781 B
Python

from django.db import models
# Create your models here.
class Nomenclature(models.Model):
code = models.CharField(max_length=50, unique=True)
name = models.CharField(max_length=255)
applies_to = models.CharField(
max_length=50,
choices=[("vehicle", "Vehicle"), ("container", "Container")]
)
class NomenclatureField(models.Model):
TEXT = "text"
NUMBER = "number"
BOOL = "bool"
CHOICE = "choice"
FIELD_TYPES = [
(TEXT, "Text"),
(NUMBER, "Number"),
(BOOL, "Boolean"),
(CHOICE, "Choice"),
]
nomenclature = models.ForeignKey(
Nomenclature, on_delete=models.CASCADE
)
key = models.CharField(max_length=50)
field_type = models.CharField(max_length=20, choices=FIELD_TYPES)