Improve document comment app
Add keyword arguments to URL definitions and reverse resolution. Raise HTTP error 404 instead of 403 to reduce the information divulged. Add view tests. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -10,26 +10,26 @@ from .views import (
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^comment/(?P<pk>\d+)/delete/$', DocumentCommentDeleteView.as_view(),
|
||||
name='comment_delete'
|
||||
regex=r'^comments/(?P<comment_pk>\d+)/delete/$', name='comment_delete',
|
||||
view=DocumentCommentDeleteView.as_view()
|
||||
),
|
||||
url(
|
||||
r'^(?P<pk>\d+)/comment/add/$', DocumentCommentCreateView.as_view(),
|
||||
name='comment_add'
|
||||
regex=r'^documents/(?P<document_pk>\d+)/comments/add/$',
|
||||
name='comment_add', view=DocumentCommentCreateView.as_view()
|
||||
),
|
||||
url(
|
||||
r'^(?P<pk>\d+)/comment/list/$',
|
||||
DocumentCommentListView.as_view(), name='comments_for_document'
|
||||
regex=r'^documents/(?P<document_pk>\d+)/comments/$',
|
||||
name='comments_for_document', view=DocumentCommentListView.as_view()
|
||||
),
|
||||
]
|
||||
|
||||
api_urls = [
|
||||
url(
|
||||
r'^documents/(?P<document_pk>[0-9]+)/comments/$',
|
||||
APICommentListView.as_view(), name='comment-list'
|
||||
regex=r'^documents/(?P<document_pk>[0-9]+)/comments/$',
|
||||
name='comment-list', view=APICommentListView.as_view()
|
||||
),
|
||||
url(
|
||||
r'^documents/(?P<document_pk>[0-9]+)/comments/(?P<comment_pk>[0-9]+)/$',
|
||||
APICommentView.as_view(), name='comment-detail'
|
||||
regex=r'^documents/(?P<document_pk>[0-9]+)/comments/(?P<comment_pk>[0-9]+)/$',
|
||||
name='comment-detail', view=APICommentView.as_view()
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user