I am registering urls in the API Root using DefaultRouter for my viewsets in views.py, but I also would like to include urls from a specific based APIView, and these last ones don't show up in my API Root.
from django.conf.urls import url, patterns, include
from rest_framework import viewsets, routers
from rest_framework.generics import ListCreateAPIView
from tdcp_reports import views
from rest_framework.urlpatterns import format_suffix_patterns
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'aapps', views.PublicAdministrationPaginated)
router.register(r'indicators', views.IndicatorDescriptionPaginated)
router.register(r'local_indicators', views.LocalIndicatorPaginated)
urlpatterns = patterns('',
url(r'^', include(router.urls)),
url(r'^province/', views.province_view, name='test-province'), # <------------ THIS ONE DOESN'T SHOW UP
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
)
@api_view(['GET'])
def province_view(request):
queryset = Province.objects.all()
renderer_classes = [r.CSVRenderer] + api_settings.DEFAULT_RENDERER_CLASSES
def get(self, request, format=None):
"""
Return a list of all provinces.
"""
return Response(queryset)
....