Example #1
0
urlpatterns = [
    # old tests
    re_path(
        r"identities/default/(?P<pk>\d+)$",
        GenericIdentity.as_view(),
        name="user-default",
    ),
    re_path(
        r"^entries/(?P<entry_pk>[^/.]+)/blog$",
        BlogViewSet.as_view({"get": "retrieve"}),
        name="entry-blog",
    ),
    re_path(
        r"^entries/(?P<entry_pk>[^/.]+)/comments$",
        CommentViewSet.as_view({"get": "list"}),
        name="entry-comments",
    ),
    re_path(
        r"^entries/(?P<entry_pk>[^/.]+)/suggested/$",
        EntryViewSet.as_view({"get": "list"}),
        name="entry-suggested",
    ),
    re_path(
        r"^drf-entries/(?P<entry_pk>[^/.]+)/suggested/$",
        DRFEntryViewSet.as_view({"get": "list"}),
        name="drf-entry-suggested",
    ),
    re_path(
        r"entries/(?P<entry_pk>[^/.]+)/authors$",
        AuthorViewSet.as_view({"get": "list"}),
Example #2
0
router.register(r'authors', AuthorViewSet)
router.register(r'comments', CommentViewSet)
router.register(r'companies', CompanyViewset)
router.register(r'projects', ProjectViewset)
router.register(r'project-types', ProjectTypeViewset)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/$',
        EntryViewSet.as_view({'get': 'list'}),
        name='entry-suggested'),
    url(r'entries/(?P<entry_pk>[^/.]+)/blog$',
        BlogViewSet.as_view({'get': 'retrieve'}),
        name='entry-blog'),
    url(r'entries/(?P<entry_pk>[^/.]+)/comments$',
        CommentViewSet.as_view({'get': 'list'}),
        name='entry-comments'),
    url(r'entries/(?P<entry_pk>[^/.]+)/authors$',
        AuthorViewSet.as_view({'get': 'list'}),
        name='entry-authors'),
    url(r'entries/(?P<entry_pk>[^/.]+)/featured$',
        EntryViewSet.as_view({'get': 'retrieve'}),
        name='entry-featured'),
    url(r'^authors/(?P<pk>[^/.]+)/(?P<related_field>\w+)/$',
        AuthorViewSet.as_view({'get': 'retrieve_related'}),
        name='author-related'),
    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(),
router.register(r'comments', CommentViewSet)
router.register(r'companies', CompanyViewset)
router.register(r'projects', ProjectViewset)
router.register(r'project-types', ProjectTypeViewset)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^entries/(?P<entry_pk>[^/.]+)/suggested/',
        EntryViewSet.as_view({'get': 'list'}),
        name='entry-suggested'
        ),
    url(r'entries/(?P<entry_pk>[^/.]+)/blog',
        BlogViewSet.as_view({'get': 'retrieve'}),
        name='entry-blog'),
    url(r'entries/(?P<entry_pk>[^/.]+)/comments',
        CommentViewSet.as_view({'get': 'list'}),
        name='entry-comments'),
    url(r'entries/(?P<entry_pk>[^/.]+)/authors',
        AuthorViewSet.as_view({'get': 'list'}),
        name='entry-authors'),
    url(r'entries/(?P<entry_pk>[^/.]+)/featured',
        EntryViewSet.as_view({'get': 'retrieve'}),
        name='entry-featured'),

    url(r'^authors/(?P<pk>[^/.]+)/(?P<related_field>\w+)/$',
        AuthorViewSet.as_view({'get': 'retrieve_related'}),
        name='author-related'),

    url(r'^entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)',
        EntryRelationshipView.as_view(),
        name='entry-relationships'),