Add view to get the location of a parking lot

This commit is contained in:
DjBushido 2013-10-28 11:50:27 -04:00
parent 905787d0df
commit 8321385b8a

View File

@ -56,6 +56,18 @@ class RateLot(APIView):
def get(self, request): def get(self, request):
'Get the rating choice options' 'Get the rating choice options'
return Response(ParkingRating.RATING_CHOICES) return Response(ParkingRating.RATING_CHOICES)
class ParkingLotEntrance(APIView):
"""
Get the location of a parking lot
**GET**: Get the latitude, longitude, and label of a parking lot
"""
def get(self, request, lot):
# The get_object_or_404 makes sure that it's a valid lot that will have
# an entry in the LOT_ENTRANCES dictionary.
parking_lot = get_object_or_404(ParkingLot, location=lot)
return Response(ParkingLot.LOT_ENTRANCES[lot])
class RegisterUser(APIView): class RegisterUser(APIView):
""" """