Move add_to_class functions to their own module
* The new module is called methods.py and found on each app. * Add keyword arguments to add_to_class instances. * Remove catch all exception handling for the check in and check out views. * Improve checkouts tests code reducing redundant code. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -21,6 +21,7 @@ from .links import (
|
||||
link_multiple_document_cabinet_remove
|
||||
)
|
||||
from .menus import menu_cabinets
|
||||
from .methods import method_get_document_cabinets
|
||||
from .permissions import (
|
||||
permission_cabinet_add_document, permission_cabinet_delete,
|
||||
permission_cabinet_edit, permission_cabinet_remove_document,
|
||||
@@ -52,8 +53,7 @@ class CabinetsApp(MayanAppConfig):
|
||||
# Add explicit order_by as DocumentCabinet ordering Meta option has no
|
||||
# effect.
|
||||
Document.add_to_class(
|
||||
'document_cabinets',
|
||||
lambda document: DocumentCabinet.objects.filter(documents=document).order_by('parent__label', 'label')
|
||||
name='document_cabinets', value=method_get_document_cabinets
|
||||
)
|
||||
|
||||
ModelPermission.register(
|
||||
|
||||
Reference in New Issue
Block a user