urls.py 1.09 KB
Newer Older
okhin's avatar
okhin committed
1
from django.conf.urls import include, url
Aymeric Barantal's avatar
Aymeric Barantal committed
2
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
okhin's avatar
okhin committed
8
from picampaign.organization.views import CategoryViewSet, GroupTypeViewSet, GroupViewSet
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)
okhin's avatar
okhin committed
19
campaign_router.register(r'grouptypes', GroupTypeViewSet)
okhin's avatar
okhin committed
20
campaign_router.register(r'groups', GroupViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
21

Aymeric Barantal's avatar
Aymeric Barantal committed
22

okhin's avatar
okhin committed
23 24 25 26 27
urlpatterns = [
       url(r'^admin/', include(admin.site.urls)),
       url(r'^', include(router.urls)),
       url(r'^', include(campaign_router.urls))
    ]