19 lines
601 B
Python
19 lines
601 B
Python
from rest_framework import viewsets
|
|
from flight.serializers import PlaneSerializer, AirportSerializer, FlightSerializer
|
|
from flight.models import Flight, Plane, Airport
|
|
|
|
|
|
class PlaneViewSet(viewsets.ModelViewSet):
|
|
queryset = Plane.objects.all().order_by("tail_number")
|
|
serializer_class = PlaneSerializer
|
|
|
|
|
|
class AirportViewSet(viewsets.ModelViewSet):
|
|
queryset = Airport.objects.all().order_by("icao")
|
|
serializer_class = AirportSerializer
|
|
|
|
|
|
class FlightViewSet(viewsets.ModelViewSet):
|
|
queryset = Flight.objects.all().order_by("-flight_date")
|
|
serializer_class = FlightSerializer
|