Exemple #1
0
from views import FormViewSet, ControlFormViewSet, UserViewSet

# router = routers.DefaultRouter()
# router.register = (r'forms', FormViewSet)
#
# urlpatterns = [
#     url(r'^', include(router.urls))
# ]

forms_list = FormViewSet.as_view(actions={'get': 'list', 'post': 'create'})

forms_detail = ControlFormViewSet.as_view(actions={
    'get': 'retrieve',
    'put': 'update',
    'delete': 'destroy'
})

users = UserViewSet.as_view(actions={
    'post': 'create',
    'get': 'retrieve',
    'put': 'update',
    'delete': 'destroy'
})

urlpatterns = format_suffix_patterns([
    url(r'^users', users, name='users'),
    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^api/forms/$', forms_list, name='forms-list'),
    url(r'^api/forms/(?P<pk>[0-9]+)/$', forms_detail, name='forms-detail')
])
from views import (api_root, BlogContentViewSet, 
                   UserViewSet, CurrentUserView)

from rest_framework.urlpatterns import format_suffix_patterns


blogcontent_list = BlogContentViewSet.as_view({
    'get': 'list'                                           
    })
blogcontent_detail = BlogContentViewSet.as_view({
    'get': 'retrieve',
    })

user_list = UserViewSet.as_view({
    'get': 'list'
    })
user_detail = UserViewSet.as_view({
    'get': 'retrieve'
    })


urlpatterns = [
    url(r'^$', api_root),
    url(r'^blogcontent/$', blogcontent_list, name='blogcontent-list'),
    url(r'^blogcontent/(?P<pk>[0-9]+)/$', blogcontent_detail, name='blogcontent-detail'),
    
    url(r'^users/$', user_list, name='user-list'),
    url(r'^users/current/$', CurrentUserView.as_view(), name='current-user'),
    url(r'^users/(?P<pk>[0-9]+)/$', user_detail, name='user-detail'),
    
Exemple #3
0
from rest_framework import routers
from django.conf.urls import patterns, include, url
from views import UserViewSet, FileViewSet, SharedFileViewSet

# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
# router.register(r'files', FileViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^users/$',UserViewSet.as_view(),name="userlist"),
    url(r'^files/$', FileViewSet.as_view(), name="file_list"),
    url(r'^shared/files/$', SharedFileViewSet.as_view(), name="shared_files_list")
]
Exemple #4
0
                   UserViewSet, AnnotationViewSet, 
                   BlogContentCommentView, CurrentUserView,
                   VoteList, VoteDetail, VoteViewSet)

from rest_framework.urlpatterns import format_suffix_patterns


blogcontent_list = BlogContentViewSet.as_view({
    'get': 'list'                                           
    })
blogcontent_detail = BlogContentViewSet.as_view({
    'get': 'retrieve',
    })

user_list = UserViewSet.as_view({
    'get': 'list'
    })
user_detail = UserViewSet.as_view({
    'get': 'retrieve'
    })

annotation_list = AnnotationViewSet.as_view({
    'get': 'list',
    'post': 'create'
    })
annotation_detail = AnnotationViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
    })
Exemple #5
0
#     url(r'^', include(router.urls))
# ]


forms_list = FormViewSet.as_view(actions={
    'get': 'list',
    'post': 'create'
})

forms_detail = ControlFormViewSet.as_view(actions={
    'get': 'retrieve',
    'put': 'update',
    'delete': 'destroy'
})

users = UserViewSet.as_view(actions={
    'post': 'create',
    'get': 'retrieve',
    'put': 'update',
    'delete': 'destroy'
})



urlpatterns = format_suffix_patterns([
    url(r'^users', users, name='users'),
    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^api/forms/$', forms_list, name='forms-list'),
    url(r'^api/forms/(?P<pk>[0-9]+)/$', forms_detail, name='forms-detail')
])
Exemple #6
0
from rest_framework import routers
from django.conf.urls import patterns, include, url
from views import UserViewSet, FileViewSet, SharedFileViewSet

# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
# router.register(r'files', FileViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^users/$', UserViewSet.as_view(), name="userlist"),
    url(r'^files/$', FileViewSet.as_view(), name="file_list"),
    url(r'^shared/files/$',
        SharedFileViewSet.as_view(),
        name="shared_files_list")
]
Exemple #7
0
# -*- coding: UTF-8 -*-  
from django.conf.urls import patterns, url, include
from rest_framework import  routers
from views import UserViewSet,GetUserByName,CreateUserByNameAndPassword,UpdateUserInfoByID,DeleteUserByName,NeiHanArticleViewSet
import views
from django.views.generic import RedirectView
from django.conf import settings
from django.conf.urls.static import static

student_detail = UserViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
})

# ViewSets define the view behavior.


# Routers provide an easy way of automatically determining the URL conf
router = routers.DefaultRouter()
router.register(r'user', UserViewSet)
router.register(r'NeiHanArticle', NeiHanArticleViewSet) #
router.register(r'NHArtComment', views.NHArtCommentViewSet)
router.register(r'Poetry', views.PoetryViewSet)
router.register(r'Collection', views.CollectionViewSet)
router.register(r'attention', views.AttentionViewSet)

#router.register(r'Image', views.MyImageViewSet)