Sort the list of document's cabinets.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-09-05 03:44:15 -04:00
parent 9fbcfcf00f
commit 99dc39783c
2 changed files with 4 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
to Jesaja Everling(@jeverling) for the report.
- Sort the list of root cabinets. Thanks to Thomas Plotkowiak
for the request.
- Sort the list of a document's cabinets.
2.7.1 (2017-09-03)
==================

View File

@@ -48,9 +48,11 @@ class CabinetsApp(MayanAppConfig):
APIEndPoint(app=self, version_string='1')
# 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)
lambda document: DocumentCabinet.objects.filter(documents=document).order_by('parent__label', 'label')
)
ModelPermission.register(