urls.py 1.02 KB
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
8
from picampaign.organization.views import CategoryViewSet
Aymeric Barantal's avatar
Aymeric Barantal committed
9 10 11 12 13 14 15

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

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

Aymeric Barantal's avatar
Aymeric Barantal committed
20 21 22 23 24

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