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.
98 lines
3.1 KiB
Python
98 lines
3.1 KiB
Python
|
|
from django.db import models
|
|
from common.models import LinesModel, ContainerTypeModel
|
|
# from payments.models import ContainerTariffPeriod, AdditionalFees
|
|
|
|
# Create your models here.
|
|
class Container(models.Model):
|
|
number = models.CharField(max_length=11)
|
|
line = 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.ForeignKey(
|
|
'accounts.DepotUser',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_received_by',
|
|
)
|
|
receive_vehicle = 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.ForeignKey(
|
|
'accounts.DepotUser',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_swept_by',
|
|
blank=True,
|
|
null=True
|
|
)
|
|
washed = models.BooleanField(default=False)
|
|
washed_on = models.DateTimeField(blank=True, null=True)
|
|
washed_by = models.ForeignKey(
|
|
'accounts.DepotUser',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_washed_by',
|
|
blank=True,
|
|
null=True
|
|
)
|
|
preinfo = models.ForeignKey(
|
|
'preinfo.Preinfo',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_preinfo',
|
|
)
|
|
booking = models.ForeignKey(
|
|
'booking.Booking',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_bookings',
|
|
blank = True,
|
|
null = True
|
|
)
|
|
expedited = models.BooleanField(default=False)
|
|
expedited_on = models.DateTimeField(blank=True, null=True)
|
|
expedited_by = models.ForeignKey(
|
|
'accounts.DepotUser',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_expedited_by',
|
|
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'
|
|
)
|
|
class ContainerPhotos(models.Model):
|
|
container = models.ForeignKey(
|
|
Container,
|
|
on_delete=models.CASCADE,
|
|
related_name='photos',
|
|
)
|
|
photo = models.TextField(blank=True, null=True)
|
|
uploaded_on = models.DateTimeField(auto_now_add=True)
|
|
uploaded_by = models.ForeignKey(
|
|
'accounts.DepotUser',
|
|
on_delete=models.CASCADE,
|
|
related_name='container_photos_uploaded_by',
|
|
)
|
|
|