urls.py 926 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)
7
from picampaign.feedback.views import FeedbackViewSet
Aymeric Barantal's avatar
Aymeric Barantal committed
8 9 10 11 12 13 14

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

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

Aymeric Barantal's avatar
Aymeric Barantal committed
18 19 20 21 22

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