forked from django-json-api/django-rest-framework-json-api
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurls_test.py
45 lines (37 loc) · 1.62 KB
/
urls_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
fromdjango.conf.urlsimportinclude, url
fromrest_frameworkimportrouters
fromexample.viewsimport (
BlogViewSet, EntryViewSet, AuthorViewSet, CommentViewSet, CompanyViewset, ProjectViewset,
EntryRelationshipView, BlogRelationshipView, CommentRelationshipView, AuthorRelationshipView)
from .api.resources.identityimportIdentity, GenericIdentity
router=routers.DefaultRouter(trailing_slash=False)
router.register(r'blogs', BlogViewSet)
router.register(r'entries', EntryViewSet)
router.register(r'authors', AuthorViewSet)
router.register(r'comments', CommentViewSet)
router.register(r'companies', CompanyViewset)
router.register(r'projects', ProjectViewset)
# for the old tests
router.register(r'identities', Identity)
urlpatterns= [
url(r'^', include(router.urls)),
# old tests
url(r'identities/default/(?P<pk>\d+)',
GenericIdentity.as_view(), name='user-default'),
url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/',
EntryViewSet.as_view({'get': 'list'}),
name='entry-suggested'
),
url(r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
EntryRelationshipView.as_view(),
name='entry-relationships'),
url(r'^blogs/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
BlogRelationshipView.as_view(),
name='blog-relationships'),
url(r'^comments/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
CommentRelationshipView.as_view(),
name='comment-relationships'),
url(r'^authors/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
AuthorRelationshipView.as_view(),
name='author-relationships'),
]