diff --git a/.gitignore b/.gitignore index 266ba65..991e24d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ *.pyc *.sqlite *.sublime* +*.swp bin/ include/ lib/ local/ -.codeintel/ \ No newline at end of file +.codeintel/ diff --git a/uncc_gameday/gameday/urls.py b/uncc_gameday/gameday/urls.py index 41dbc87..5b96040 100644 --- a/uncc_gameday/gameday/urls.py +++ b/uncc_gameday/gameday/urls.py @@ -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)$', views.SingleParkingLotList.as_view(), name='parking-lot'), url('^rate/$', views.RateLot.as_view(), name='parking-rating'), -) \ No newline at end of file +) diff --git a/uncc_gameday/gameday/views.py b/uncc_gameday/gameday/views.py index 51d0ef7..e38a92a 100755 --- a/uncc_gameday/gameday/views.py +++ b/uncc_gameday/gameday/views.py @@ -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 @@ -43,4 +52,4 @@ class RateLot(APIView): def get(self, request): 'Get the rating choice options' - return Response(ParkingRating.RATING_CHOICES) \ No newline at end of file + return Response(ParkingRating.RATING_CHOICES)