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.
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
from django.db import models
|
|
from common.models import LinesModel, ContainerTypeModel
|
|
|
|
# Create your models here.
|
|
class Container(models.Model):
|
|
number = models.CharField(max_length=11)
|
|
line_id = models.ForeignKey(
|
|
LinesModel,
|
|
on_delete=models.CASCADE,
|
|
related_name='container_lines',
|
|
)
|
|
container_type = models.ForeignKey(
|
|
ContainerTypeModel,
|
|
on_delete=models.CASCADE,
|
|
related_name='container_container_types',
|
|
)
|
|
received_on = models.DateTimeField(auto_now_add=True)
|
|
received_by = models.IntegerField()
|
|
receive_vehicles = models.CharField(max_length=100, blank=True, null=True)
|
|
damages = models.TextField(blank=True, null=True)
|
|
heavy_damaged = models.BooleanField(default=False)
|
|
position = models.CharField(max_length=100, blank=True, null=True)
|
|
swept = models.BooleanField(default=False)
|
|
swept_on = models.DateTimeField(blank=True, null=True)
|
|
swept_by = models.IntegerField(blank=True, null=True)
|
|
washed = models.BooleanField(default=False)
|
|
washed_on = models.DateTimeField(blank=True, null=True)
|
|
washed_by = models.IntegerField(blank=True, null=True)
|
|
booking = models.ForeignKey(
|
|
'booking.BookingModel',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_bookings',
|
|
)
|
|
expedited = models.BooleanField(default=False)
|
|
expedited_on = models.DateTimeField(blank=True, null=True)
|
|
expedited_by = models.IntegerField(blank=True, null=True)
|
|
expedition_vehicle = models.CharField(max_length=100, blank=True, null=True)
|
|
|
|
|
|
class ContainerHistory(Container):
|
|
operation = models.ForeignKey(
|
|
'common.OperationModel',
|
|
on_delete=models.CASCADE,
|
|
related_name='history_operations',
|
|
)
|
|
operation_date = models.DateTimeField(auto_now_add=True)
|
|
container = models.ForeignKey(
|
|
Container,
|
|
on_delete=models.CASCADE,
|
|
related_name='history_containers'
|
|
)
|