urls.py 816 Bytes
Newer Older
Aymeric Barantal's avatar
Aymeric Barantal committed
1 2
from django.conf.urls import patterns, include, url
from django.contrib import admin
Aymeric Barantal's avatar
Aymeric Barantal committed
3
from rest_framework_nested import routers
Aymeric Barantal's avatar
Aymeric Barantal committed
4

5 6
from picampaign.campaign.views import (CampaignViewSet, CampaignContactViewSet,
                                       ArgumentaryViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
7 8 9 10 11 12 13

router = routers.SimpleRouter()
router.register(r'campaigns', CampaignViewSet)

campaign_router = routers.NestedSimpleRouter(router, r'campaigns',
                                             lookup='campaign')
campaign_router.register(r'contacts', CampaignContactViewSet)
14
campaign_router.register(r'arguments', ArgumentaryViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
15

Aymeric Barantal's avatar
Aymeric Barantal committed
16 17 18 19 20

urlpatterns = patterns('',
                       url(r'^admin/', include(admin.site.urls)),
                       url(r'^', include(router.urls)),
                       url(r'^', include(campaign_router.urls)))