Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI 41 Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patricia Isabella Nava
CSCI 41 Project
Commits
57624a94
Commit
57624a94
authored
Nov 27, 2022
by
Stephanie Tullao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tables for Booking_Sched, Booking_AddItem, Pilot, and Flight_Attendant
parent
8a68864c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
15 deletions
+68
-15
models.py
MagisAir/booking/models.py
+68
-15
No files found.
MagisAir/booking/models.py
View file @
57624a94
...
...
@@ -33,40 +33,93 @@ class Booking(models.Model):
Total_Cost
=
models
.
CharField
(
max_length
=
100
)
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
):
Flight_ID
=
models
.
AutoField
(
primary_key
=
True
,
editable
=
False
,
unique
=
True
)
Flight_Code
=
models
.
CharField
(
max_length
=
5
)
Origin_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
):
Sched_Code
=
models
.
AutoField
(
primary_key
=
True
,
editable
=
False
,
unique
=
True
)
Flight_Date
=
models
.
DateField
Departure_Time
=
models
.
TimeField
Arri
c
al_Time
=
models
.
TimeField
Arri
v
al_Time
=
models
.
TimeField
Duration
=
models
.
CharField
(
max_length
=
50
)
Flight_Cost
=
models
.
CharField
(
max_length
=
50
)
Flight_Code
=
models
.
ForeignKey
(
Flight
,
on_delete
=
models
.
CASCADE
)
class
Sched_Crew
(
models
.
Model
):
class
Booking_Sched
(
models
.
Model
):
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
)
Employee_ID
=
models
.
ForeignKey
(
Crew_Member
,
on_delete
=
models
.
CASCADE
)
class
Booking_AddItem
(
models
.
Model
):
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
):
Airport_Code
=
models
.
AutoField
(
primary_key
=
True
,
editable
=
False
,
unique
=
True
)
Airport_name
=
models
.
CharField
(
max_length
=
50
)
City_Name
=
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment