mirror of
https://github.com/bspeice/UNCCGameDay-Server
synced 2024-12-04 13:58:14 -05:00
Add the API root
This commit is contained in:
parent
658db9981a
commit
4443572436
@ -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'),
|
||||
)
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user