urls.py 864 Bytes
Newer Older
1
2
3
4
# Future Imports
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

5
6
# Django Imports
from django.conf.urls import include, url
7
from django.views.generic.base import RedirectView
8
9
10
11
12

# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet

# Other Imports
13
14
from rest_framework.routers import DefaultRouter

15
# Instantiate our DefaultRouter
16
17
18
19
20
21
ROUTER = DefaultRouter()

# Register views to the API router
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)
Daniel Bond's avatar
Daniel Bond committed
22

23
urlpatterns = [
24
25
26
    # / - Default route
    # We redirect to /api since this is in reality the default page for the API
    url(r'^$', RedirectView.as_view(url='/api')),
27
28
29
    # /api - Root API URL
    url(r'^api/', include(ROUTER.urls)),
]