|
3 | 3 | from rest_framework import routers
|
4 | 4 |
|
5 | 5 | from example.views import (
|
| 6 | + AuthorRelationshipView, |
6 | 7 | AuthorViewSet,
|
| 8 | + BlogRelationshipView, |
7 | 9 | BlogViewSet,
|
| 10 | + CommentRelationshipView, |
8 | 11 | CommentViewSet,
|
9 | 12 | CompanyViewset,
|
| 13 | + EntryRelationshipView, |
10 | 14 | EntryViewSet,
|
| 15 | + NonPaginatedEntryViewSet, |
11 | 16 | ProjectViewset
|
12 | 17 | )
|
13 | 18 |
|
14 | 19 | router = routers.DefaultRouter(trailing_slash=False)
|
15 | 20 |
|
16 | 21 | router.register(r'blogs', BlogViewSet)
|
17 | 22 | router.register(r'entries', EntryViewSet)
|
| 23 | +router.register(r'nopage-entries', NonPaginatedEntryViewSet, 'nopage-entry') |
18 | 24 | router.register(r'authors', AuthorViewSet)
|
19 | 25 | router.register(r'comments', CommentViewSet)
|
20 | 26 | router.register(r'companies', CompanyViewset)
|
21 | 27 | router.register(r'projects', ProjectViewset)
|
22 | 28 |
|
23 | 29 | urlpatterns = [
|
24 | 30 | url(r'^', include(router.urls)),
|
| 31 | + url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/', |
| 32 | + EntryViewSet.as_view({'get': 'list'}), |
| 33 | + name='entry-suggested' |
| 34 | + ), |
| 35 | + url(r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)', |
| 36 | + EntryRelationshipView.as_view(), |
| 37 | + name='entry-relationships'), |
| 38 | + url(r'^blogs/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)', |
| 39 | + BlogRelationshipView.as_view(), |
| 40 | + name='blog-relationships'), |
| 41 | + url(r'^comments/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)', |
| 42 | + CommentRelationshipView.as_view(), |
| 43 | + name='comment-relationships'), |
| 44 | + url(r'^authors/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)', |
| 45 | + AuthorRelationshipView.as_view(), |
| 46 | + name='author-relationships'), |
25 | 47 | ]
|
26 | 48 |
|
27 | 49 |
|
|
0 commit comments