urls.py 1.27 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 9
from picampaign.organization.views import (CategoryViewSet, GroupTypeViewSet,
                                            GroupViewSet, OrganizationViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
10 11 12 13 14 15 16

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

campaign_router = routers.NestedSimpleRouter(router, r'campaigns',
                                             lookup='campaign')
campaign_router.register(r'contacts', CampaignContactViewSet)
17
campaign_router.register(r'arguments', ArgumentaryViewSet)
18
campaign_router.register(r'categories', CategoryViewSet)
19
campaign_router.register(r'feedbacks', FeedbackViewSet)
okhin's avatar
okhin committed
20
campaign_router.register(r'grouptypes', GroupTypeViewSet)
okhin's avatar
okhin committed
21
campaign_router.register(r'groups', GroupViewSet)
okhin's avatar
okhin committed
22
campaign_router.register(r'organization', OrganizationViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
23

Aymeric Barantal's avatar
Aymeric Barantal committed
24

okhin's avatar
okhin committed
25 26 27
urlpatterns = [
       url(r'^admin/', include(admin.site.urls)),
       url(r'^', include(router.urls)),
okhin's avatar
okhin committed
28
       url(r'^', include(campaign_router.urls)),
okhin's avatar
okhin committed
29
       url(r'^i18n/', include('django.conf.urls.i18n'))
okhin's avatar
okhin committed
30
    ]