logbook-django/logbook/flight/views.py

19 lines
601 B
Python
Raw Normal View History

2019-09-16 00:32:42 +00:00
from rest_framework import viewsets
from flight.serializers import PlaneSerializer, AirportSerializer, FlightSerializer
from flight.models import Flight, Plane, Airport
2019-09-15 05:38:18 +00:00
2019-09-16 00:32:42 +00:00
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