Commit 57624a94 authored by Stephanie Tullao's avatar Stephanie Tullao

Added tables for Booking_Sched, Booking_AddItem, Pilot, and Flight_Attendant

parent 8a68864c
...@@ -33,40 +33,93 @@ class Booking(models.Model): ...@@ -33,40 +33,93 @@ class Booking(models.Model):
Total_Cost = models.CharField(max_length=100) Total_Cost = models.CharField(max_length=100)
P_ID = models.ForeignKey(Passenger, on_delete=models.CASCADE) P_ID = models.ForeignKey(Passenger, on_delete=models.CASCADE)
class Crew_Member(models.Model):
Employee_ID = models.AutoField(primary_key=True, editable=False, unique=True)
Fname = models.CharField(max_length=50)
Lname = models.CharField(max_length = 50)
Role = models.CharField(max_length=50)
class Flight(models.Model): class Flight(models.Model):
Flight_ID = models.AutoField(primary_key=True, editable=False, unique=True) Flight_ID = models.AutoField(primary_key=True, editable=False, unique=True)
Flight_Code = models.CharField(max_length=5) Flight_Code = models.CharField(max_length=5)
Origin_Airport = models.CharField(max_length=100) Origin_Airport = models.CharField(max_length=100)
Destination_Airport = models.CharField(max_length=100) Destination_Airport = models.CharField(max_length=100)
class Additional_Item(models.Model):
Description = models.CharField(max_length=50, primary_key=True, editable=False, unique=True)
Item_Cost = models.CharField(max_length=20)
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 Flight_Date = models.DateField
Departure_Time = models.TimeField Departure_Time = models.TimeField
Arrical_Time = models.TimeField Arrival_Time = models.TimeField
Duration = models.CharField(max_length=50) Duration = models.CharField(max_length=50)
Flight_Cost = models.CharField(max_length=50) Flight_Cost = models.CharField(max_length=50)
Flight_Code = models.ForeignKey(Flight, on_delete=models.CASCADE) Flight_Code = models.ForeignKey(Flight, on_delete=models.CASCADE)
class Sched_Crew(models.Model): class Booking_Sched(models.Model):
class Meta: class Meta:
unique_together = (('Sched_Code', 'Employee_ID'),) unique_together = ('Booking_ID', 'Sched_Code')
Booking_ID = models.ForeignKey(Booking, unique=True, on_delete=models.CASCADE)
Sched_Code = models.ForeignKey(Schedule, unique=True, on_delete=models.CASCADE)
class Additional_Item(models.Model):
Description = models.CharField(max_length=50, primary_key=True, editable=False, unique=True)
Item_Cost = models.CharField(max_length=20)
Sched_Code = models.ForeignKey(Schedule, on_delete=models.CASCADE) class Booking_AddItem(models.Model):
Employee_ID = models.ForeignKey(Crew_Member, on_delete=models.CASCADE) class Meta:
unique_together = ('Booking_ID', 'AddItem_Desc')
Booking_ID = models.ForeignKey(Booking, unique=True, on_delete=models.CASCADE)
AddItem_Desc = models.ForeignKey(Additional_Item, unique=True, on_delete=models.CASCADE)
Quantity = models.IntegerField(default=0)
class City(models.Model): class City(models.Model):
Airport_Code = models.AutoField(primary_key=True, editable=False, unique=True) Airport_Code = models.AutoField(primary_key=True, editable=False, unique=True)
Airport_name = models.CharField(max_length=50) Airport_name = models.CharField(max_length=50)
City_Name = models.CharField(max_length=50) City_Name = models.CharField(max_length=50)
Country = models.CharField(max_length=50) Country = models.CharField(max_length=50)
class Crew_Member(models.Model):
Employee_ID = models.AutoField(primary_key=True, editable=False, unique=True)
Fname = models.CharField(max_length=50)
Lname = models.CharField(max_length=50)
pilot = 'Pilot'
flight_attendant = 'Flight Attendant'
role_choices = [
(pilot, 'Pilot'),
(flight_attendant, 'Flight Attendant')
]
Role = models.CharField(max_length=50, choices=role_choices)
class Sched_Crew(models.Model):
class Meta:
unique_together = ('Sched_Code', 'Employee_ID')
Sched_Code = models.ForeignKey(Schedule, unique=True, on_delete=models.CASCADE)
Employee_ID = models.ForeignKey(Crew_Member, unique=True, on_delete=models.CASCADE)
class Pilot(models.Model):
Employee_ID = models.ForeignKey(Crew_Member, unique=True, on_delete=models.CASCADE, primary_key=True)
cadet_pilot = 'Cadet Pilot'
second_officer = 'Second Officer'
first_officer = 'First Officer'
senior_firstofficer = 'Senior First Officer'
captain = 'Captain'
rank_choices = [
(cadet_pilot, 'Cadet Pilot'),
(second_officer, 'Second Officer'),
(first_officer, 'First Officer'),
(senior_firstofficer, 'Senior First Officer'),
(captain, 'Captain')
]
Rank = models.CharField(max_length=50, choices=rank_choices)
class Flight_Attendant(models.Model):
Employee_ID = models.ForeignKey(Crew_Member, unique=True, on_delete=models.CASCADE, primary_key=True)
economy = 'Economy'
premium_economy = 'Premium Economy'
business = 'Business'
first_class = 'First Class'
class_choices = [
(economy, 'Economy'),
(premium_economy, 'Premium Economy'),
(business, 'Business'),
(first_class, 'First Class')
]
Assigned_Class = models.CharField(max_length=50, choices=class_choices)
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