Add a single-lot view

This commit is contained in:
Bradlee Speice 2013-10-18 18:10:28 -04:00
parent 4bd46f9e71
commit 92b8bb6392
3 changed files with 14 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
*.pyc
*.sqlite
*.sublime*
*.swp
bin/
include/
lib/

View File

@ -4,5 +4,6 @@ import views
urlpatterns = patterns('gameday.views',
url('^$', 'api_root'),
url('^lots/$', views.ParkingLotList.as_view(), name='parking-lots'),
url('^lots/(?P<lot>)$', views.SingleParkingLotList.as_view(), name='parking-lot'),
url('^rate/$', views.RateLot.as_view(), name='parking-rating'),
)

View File

@ -26,6 +26,15 @@ class ParkingLotList(APIView):
serializer = ParkingLotSerializer(parking_lots, many=True)
return Response(serializer.data)
class SingleParkingLotList(APIView):
"""
List a single parking lot
"""
def get(self, request, lot):
parking_lot = ParkingLot.objects.filter(location=lot)
return Response(ParkingLotSerializer(parking_lot))
class RateLot(APIView):
"""
Rate a parking lot