Add new serialization code

This commit is contained in:
Bradlee Speice
2013-10-14 22:31:36 -04:00
parent 269795202d
commit 7be5cd6f97
8 changed files with 51 additions and 7 deletions

View File

@ -1 +1,15 @@
# Create your views here.
from models import ParkingLot
from serializers import ParkingLotSerializer
from rest_framework.views import APIView
from rest_framework.response import Response
class ParkingLotList(APIView):
"""
List all parking lots
"""
def get(self, request):
parking_lots = ParkingLot.objects.all()
serializer = ParkingLotSerializer(parking_lots, many=True)
return Response(serializer.data)