Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed May 19, 2024
1 parent bbe9ddd commit c00966f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 07_Testing-CI-CD/airline0/flights/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ def index(request):
})

def flight(request, flight_id):
flight = Flight.objects.get(pk=flight_id)
try:
flight = Flight.objects.get(pk=flight_id)
except Flight.DoesNotExist:
raise Http404("Flight does not exist")
return render(request, "flights/flight.html", {
"flight": flight,
"flight": flight,
"passengers": flight.passengers.all(),
"non_passengers": Passenger.objects.exclude(flights=flight).all()
})
Expand Down

0 comments on commit c00966f

Please sign in to comment.