示例#1
0
news_urls = patterns('',
    url(r'^/$', NewsList.as_view(), name='news-list'),
)

product_urls = patterns('',
    url(r'^/(?P<company>[0-9a-zA-Z_-]+)/$', ProductList.as_view(), name='product-list'),
    url(r'^/(?P<company>[0-9a-zA-Z_-]+)/(?P<product>[0-9a-zA-Z_-]+)/$', ProductDetail.as_view(), name='product-detail')
)

value_urls = patterns('',
    url(r'^/$', ValueList.as_view(), name='value-list'),
    url(r'^/(?P<slug>[0-9a-zA-Z_-]+)/$', ValueDetail.as_view(), name='value-detail'),
)

urlpatterns = patterns('',
    #url(r'^$', IndexView.as_view(), name='home'),
    url(r'^api/v1/causes', include(cause_urls)),
    url(r'^api/v1/cause-members', include(cause_member_urls)),
    url(r'^api/v1/companies', include(company_urls)),
    url(r'^api/v1/images', include(image_urls)),
    url(r'^api/v1/news', include(news_urls)),
    url(r'^api/v1/products', include(product_urls)),
    url(r'^api/v1/users', include(account_urls)),
    url(r'^api/v1/values', include(value_urls)),
    url(r'^api/v1/auth/login/$', 'rest_framework_jwt.views.obtain_jwt_token'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^restricted/$', RestrictedView.as_view()),  #for testing purposes
    url(r'.*', IndexView.as_view(), name='home'), #I wonder if this is the best way to do it
)
示例#2
0
文件: urls.py 项目: CFGLondon/team-1
from authentication.views import RestrictedView, UserView, CompanyView
from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns(
    '',
    url(r'^api/user/register/$', UserView.as_view(), name='register_user'),
    url(r'^api/company/register/$', CompanyView.as_view(), name='register_company'),
    url(r'^api/get_token/$', 'rest_framework_jwt.views.obtain_jwt_token'),
    url(r'^api/authenticated/$', RestrictedView.as_view(), name='test_token'),
    url(r'^admin/', include(admin.site.urls)),
)