Last active
August 29, 2015 14:12
-
-
Save ajrouvoet/2baafee054f9c2712630 to your computer and use it in GitHub Desktop.
rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import routers, serializers, viewsets | |
from django.conf.urls import url, include | |
from core.views import * | |
class BatchRouter(routers.DefaultRouter): | |
routes = [ | |
routers.Route( | |
url=r'^{prefix}{trailing_slash}$', | |
mapping={ | |
'post': 'batch_create', | |
'get': 'list', | |
'put': 'batch_update', | |
'delete': 'batch_delete' | |
}, | |
name='{basename}-list', | |
initkwargs={'suffix': 'List'} | |
) | |
] + routers.DefaultRouter.routes | |
router = BatchRouter(trailing_slash=False) | |
router.register(r'product', ProductViewSet) | |
router.register(r'vendor', VendorViewSet) | |
router.register(r'enrichment', EnrichmentViewSet) | |
router.register(r'store', StoreViewSet) | |
router.register(r'price', ItemPriceViewSet) | |
urls = [ | |
url(r'^', include(router.urls)), | |
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment