23 lines
865 B
Python
23 lines
865 B
Python
from django.contrib.gis.db import models
|
|
|
|
from apps.gto.models.model_equipment import Equipment
|
|
from apps.workerslocation.models.workers_locations import WorkersLocation
|
|
|
|
|
|
class DangerZone(models.Model):
|
|
name = models.CharField(max_length=128)
|
|
polygon = models.PolygonField(srid=4326)
|
|
accessed_worker = models.ManyToManyField(WorkersLocation, blank=True, verbose_name="Допущенные сотрудники")
|
|
accessed_equipment = models.ManyToManyField(Equipment, blank=True, verbose_name="Допущенный транспорт")
|
|
active = models.BooleanField(default=True)
|
|
|
|
def __str__(self) -> str:
|
|
return self.name
|
|
|
|
class Meta:
|
|
ordering = ["name"]
|
|
verbose_name = "опасная зона"
|
|
verbose_name_plural = "опасные зоны"
|
|
indexes = [models.Index(fields=["name"]),
|
|
]
|