chore: make some fields of booking_schedule read-only after creation and add...

chore: make some fields of booking_schedule read-only after creation and add fields to __str__ function of Schedule model
parent 3e0db2df
......@@ -19,6 +19,11 @@ class Sched_CrewAdmin(admin.ModelAdmin):
class ScheduleAdmin(admin.ModelAdmin):
model = Schedule
list_display = ('Sched_Code', 'Flight_Date', 'Departure_Time', 'Arrival_Time', 'Duration', 'Flight_Cost', 'Flight_Code')
def get_readonly_fields(self, request, obj=None):
if obj:
return ['Departure_Time', 'Flight_Date', 'Arrival_Time', 'Duration']
else:
return []
class CityAdmin(admin.ModelAdmin):
model = City
......
......@@ -70,7 +70,7 @@ class Schedule(models.Model):
Flight_Code = models.ForeignKey(Flight, on_delete=models.CASCADE)
def __str__(self):
return str(self.Sched_Code)
return str(self.Sched_Code) + " - " + str(self.Flight_Code) + " " + str(self.Flight_Date) + " ETD: " + str(self.Departure_Time)
class Booking(models.Model):
......
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