From 8bcd2c247f491e164a416d817790a85481a81107 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 21 Aug 2019 04:25:16 -0400 Subject: [PATCH] Rename checkout views and URLs for clarity Signed-off-by: Roberto Rosario --- mayan/apps/checkouts/urls.py | 13 ++++++------ mayan/apps/checkouts/views.py | 38 +++++++++++++++++------------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/mayan/apps/checkouts/urls.py b/mayan/apps/checkouts/urls.py index 994d18edde..87dfff5c73 100644 --- a/mayan/apps/checkouts/urls.py +++ b/mayan/apps/checkouts/urls.py @@ -4,24 +4,25 @@ from django.conf.urls import url from .api_views import APICheckedoutDocumentListView, APICheckedoutDocumentView from .views import ( - CheckoutDocumentView, CheckoutDetailView, CheckoutListView, - DocumentCheckinView + DocumentCheckOutView, DocumentCheckOutDetailView, DocumentCheckOutListView, + DocumentCheckInView ) urlpatterns = [ url( - regex=r'^list/$', view=CheckoutListView.as_view(), name='check_out_list' + regex=r'^documents/$', view=DocumentCheckOutListView.as_view(), + name='check_out_list' ), url( - regex=r'^(?P\d+)/check/out/$', view=CheckoutDocumentView.as_view(), + regex=r'^documents/(?P\d+)/check/out/$', view=DocumentCheckOutView.as_view(), name='check_out_document' ), url( - regex=r'^(?P\d+)/check/in/$', view=DocumentCheckinView.as_view(), + regex=r'^documents/(?P\d+)/check/in/$', view=DocumentCheckInView.as_view(), name='check_in_document' ), url( - regex=r'^(?P\d+)/check/info/$', view=CheckoutDetailView.as_view(), + regex=r'^documents/(?P\d+)/check/info/$', view=DocumentCheckOutDetailView.as_view(), name='check_out_info' ), ] diff --git a/mayan/apps/checkouts/views.py b/mayan/apps/checkouts/views.py index 65063d2cfe..4bab799063 100644 --- a/mayan/apps/checkouts/views.py +++ b/mayan/apps/checkouts/views.py @@ -24,7 +24,7 @@ from .permissions import ( ) -class DocumentCheckinView(ConfirmView): +class DocumentCheckInView(ConfirmView): def get_extra_context(self): document = self.get_object() @@ -82,7 +82,21 @@ class DocumentCheckinView(ConfirmView): ) -class CheckoutDocumentView(SingleObjectCreateView): +class DocumentCheckOutDetailView(SingleObjectDetailView): + form_class = DocumentCheckoutDefailForm + model = Document + object_permission = permission_document_check_out_detail_view + + def get_extra_context(self): + return { + 'object': self.object, + 'title': _( + 'Check out details for document: %s' + ) % self.object + } + + +class DocumentCheckOutView(SingleObjectCreateView): form_class = DocumentCheckoutForm def dispatch(self, request, *args, **kwargs): @@ -94,7 +108,7 @@ class CheckoutDocumentView(SingleObjectCreateView): ) return super( - CheckoutDocumentView, self + DocumentCheckOutView, self ).dispatch(request, *args, **kwargs) def form_valid(self, form): @@ -131,7 +145,7 @@ class CheckoutDocumentView(SingleObjectCreateView): ) -class CheckoutListView(DocumentListView): +class DocumentCheckOutListView(DocumentListView): def get_document_queryset(self): return AccessControlList.objects.restrict_queryset( permission=permission_document_check_out_detail_view, @@ -140,7 +154,7 @@ class CheckoutListView(DocumentListView): ) def get_extra_context(self): - context = super(CheckoutListView, self).get_extra_context() + context = super(DocumentCheckOutListView, self).get_extra_context() context.update( { 'extra_columns': ( @@ -174,17 +188,3 @@ class CheckoutListView(DocumentListView): } ) return context - - -class CheckoutDetailView(SingleObjectDetailView): - form_class = DocumentCheckoutDefailForm - model = Document - object_permission = permission_document_check_out_detail_view - - def get_extra_context(self): - return { - 'object': self.object, - 'title': _( - 'Check out details for document: %s' - ) % self.object - }