chore: add default values to time and date fields of models

parent f359e477
from django.db import models from django.db import models
from django.http import Http404 from django.http import Http404
from django.core.validators import RegexValidator,EmailValidator from django.core.validators import RegexValidator,EmailValidator
from django.utils.timezone import now
# Create your models here. # Create your models here.
...@@ -9,7 +10,7 @@ class Passenger(models.Model): ...@@ -9,7 +10,7 @@ class Passenger(models.Model):
First_Name = models.CharField(max_length=50) First_Name = models.CharField(max_length=50)
Middle_Initial = models.CharField(max_length=50, blank=True) Middle_Initial = models.CharField(max_length=50, blank=True)
Last_Name = models.CharField(max_length = 50) Last_Name = models.CharField(max_length = 50)
Birthdate = models.DateField(null=True, blank=True) Birthdate = models.DateField(null=True, blank=True, default=now)
Age = models.CharField(max_length=3) Age = models.CharField(max_length=3)
male = 'Male' male = 'Male'
female = 'Female' female = 'Female'
...@@ -62,10 +63,10 @@ class Additional_Item(models.Model): ...@@ -62,10 +63,10 @@ class Additional_Item(models.Model):
class Schedule(models.Model): class Schedule(models.Model):
Sched_Code = models.AutoField(primary_key=True, editable=False, unique=True) Sched_Code = models.AutoField(primary_key=True, editable=False, unique=True)
Flight_Date = models.DateField(null=True, blank=True) Flight_Date = models.DateField(default=now, null=True, blank=True)
Departure_Time = models.TimeField(null=True, blank=True) Departure_Time = models.TimeField(null=True, blank=True, default="00:00:00")
Arrival_Time = models.TimeField(null=True, blank=True) Arrival_Time = models.TimeField(null=True, blank=True, default='00:00:00')
Duration = models.CharField(max_length=50) Duration = models.CharField(max_length=50, default = '0 hr 0 min')
Flight_Cost = models.IntegerField(default=0) Flight_Cost = models.IntegerField(default=0)
Flight_Code = models.ForeignKey(Flight, on_delete=models.CASCADE) Flight_Code = models.ForeignKey(Flight, on_delete=models.CASCADE)
...@@ -75,7 +76,7 @@ class Schedule(models.Model): ...@@ -75,7 +76,7 @@ class Schedule(models.Model):
class Booking(models.Model): class Booking(models.Model):
Booking_ID = models.AutoField(primary_key=True, editable=False, unique=True) Booking_ID = models.AutoField(primary_key=True, editable=False, unique=True)
Booking_Date = models.DateField(null=True, blank=True) Booking_Date = models.DateField(default=now, null=True)
Total_Cost = models.IntegerField(blank=True, default=0, null=False, editable=False) Total_Cost = models.IntegerField(blank=True, default=0, null=False, editable=False)
Passenger = models.ForeignKey(Passenger, on_delete=models.CASCADE) Passenger = models.ForeignKey(Passenger, on_delete=models.CASCADE)
Additional_Item = models.ManyToManyField(Additional_Item, through='Booking_AddItem') Additional_Item = models.ManyToManyField(Additional_Item, through='Booking_AddItem')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment