Add the API root

master
Bradlee Speice 2013-10-14 23:58:15 -04:00
parent 658db9981a
commit 4443572436
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,8 @@
from django.conf.urls import url, patterns
import views
urlpatterns = patterns('',
url('^lots/$', views.ParkingLotList.as_view()),
url('^rate/$', views.RateLot.as_view())
urlpatterns = patterns('gameday.views',
url('^$', 'api_root'),
url('^lots/$', views.ParkingLotList.as_view(), name='parking-lots'),
url('^rate/$', views.RateLot.as_view(), name='parking-rating'),
)

View File

@ -4,6 +4,17 @@ from serializers import *
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.decorators import api_view
from django.core.urlresolvers import reverse
@api_view(('GET',))
def api_root(request):
'Give some information about our API'
return Response({
'parking_lots': request.build_absolute_uri(reverse('parking-lots')),
'parking_rating': request.build_absolute_uri(reverse('parking-rating')),
})
class ParkingLotList(APIView):
"""