0eefaad424
This commit adds IntelliJ IDEA-specific configuration files for the project, including module setup, version control integration, inspection profiles, and workspace settings. These files facilitate development environment configuration for contributors using IntelliJ IDEA.
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
from django.db import models
|
|
from common.models import ContainerTypeModel, LinesModel, OperationModel
|
|
|
|
# Create your models here.
|
|
class Booking(models.Model):
|
|
|
|
STATUS_CHOICES = [
|
|
('active', 'Active'),
|
|
('finished', 'Finished'),
|
|
('canceled', 'Canceled'),
|
|
]
|
|
|
|
number = models.CharField(max_length=50, unique=True)
|
|
vehicles = models.CharField(blank=True, null=True)
|
|
container_type = models.ForeignKey(
|
|
ContainerTypeModel,
|
|
on_delete=models.CASCADE,
|
|
related_name='booking_container_types',
|
|
)
|
|
container_count = models.IntegerField()
|
|
container_expedited_count = models.IntegerField(default=0)
|
|
carrier = models.CharField(max_length=100, blank=True, null=True)
|
|
line = models.ForeignKey(
|
|
LinesModel,
|
|
on_delete=models.CASCADE,
|
|
related_name='booking_lines',
|
|
)
|
|
visible = models.BooleanField(default=True)
|
|
is_new = models.BooleanField(default=True)
|
|
container_number = models.CharField(max_length=11, blank=True, null=True)
|
|
vehicles_left = models.CharField(blank=True, null=True)
|
|
created_on = models.DateTimeField(auto_now_add=True)
|
|
created_by = models.IntegerField()
|
|
updated_on = models.DateTimeField(auto_now=True)
|
|
updated_by = models.IntegerField()
|
|
status = models.CharField(
|
|
max_length=10,
|
|
choices=STATUS_CHOICES,
|
|
default='active'
|
|
)
|
|
|
|
@property
|
|
def containers_left(self):
|
|
return self.container_count - (self.container_expedited_count or 0) |