mirror of
https://github.com/bspeice/UNCCGameDay-Server
synced 2024-12-04 13:58:14 -05:00
Add a single-lot view
This commit is contained in:
parent
4bd46f9e71
commit
92b8bb6392
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,8 +1,9 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.sublime*
|
*.sublime*
|
||||||
|
*.swp
|
||||||
bin/
|
bin/
|
||||||
include/
|
include/
|
||||||
lib/
|
lib/
|
||||||
local/
|
local/
|
||||||
.codeintel/
|
.codeintel/
|
||||||
|
@ -4,5 +4,6 @@ import views
|
|||||||
urlpatterns = patterns('gameday.views',
|
urlpatterns = patterns('gameday.views',
|
||||||
url('^$', 'api_root'),
|
url('^$', 'api_root'),
|
||||||
url('^lots/$', views.ParkingLotList.as_view(), name='parking-lots'),
|
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'),
|
url('^rate/$', views.RateLot.as_view(), name='parking-rating'),
|
||||||
)
|
)
|
||||||
|
@ -26,6 +26,15 @@ class ParkingLotList(APIView):
|
|||||||
serializer = ParkingLotSerializer(parking_lots, many=True)
|
serializer = ParkingLotSerializer(parking_lots, many=True)
|
||||||
return Response(serializer.data)
|
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):
|
class RateLot(APIView):
|
||||||
"""
|
"""
|
||||||
Rate a parking lot
|
Rate a parking lot
|
||||||
@ -43,4 +52,4 @@ 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user