urls.py 1.47 KB
Newer Older
okhin's avatar
okhin committed
1
from django.conf import settings
okhin's avatar
okhin committed
2
from django.conf.urls import include, url
Okhin's avatar
Okhin committed
3
from django.conf.urls.static import static
Aymeric Barantal's avatar
Aymeric Barantal committed
4
from django.contrib import admin
Aymeric Barantal's avatar
Aymeric Barantal committed
5
from rest_framework_nested import routers
Aymeric Barantal's avatar
Aymeric Barantal committed
6

7 8
from picampaign.campaign.views import (CampaignViewSet, CampaignContactViewSet,
                                       ArgumentaryViewSet)
9
from picampaign.feedback.views import FeedbackViewSet
okhin's avatar
okhin committed
10 11
from picampaign.organization.views import (CategoryViewSet, GroupTypeViewSet,
                                            GroupViewSet, OrganizationViewSet)
Aymeric Barantal's avatar
Aymeric Barantal committed
12 13 14 15 16 17 18

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

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

Aymeric Barantal's avatar
Aymeric Barantal committed
26

okhin's avatar
okhin committed
27 28 29
urlpatterns = [
       url(r'^admin/', include(admin.site.urls)),
       url(r'^', include(router.urls)),
okhin's avatar
okhin committed
30
       url(r'^', include(campaign_router.urls)),
okhin's avatar
okhin committed
31
       url(r'^i18n/', include('django.conf.urls.i18n')),
okhin's avatar
okhin committed
32
       url(r'^docs/', include('rest_framework_docs.urls'))
Okhin's avatar
Okhin committed
33
    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)