Answering my own question...
Patch mayan/apps/cabinets/views.py b/mayan/apps/cabinets/views.py:
Add at/near the top:
from django.views.generic.list import MultipleObjectMixin
from django.conf import settings
from pure_pagination import Paginator, EmptyPage, PageNotAnInteger
from pure_pagination.mixins import PaginationMixin
Modify the CabinetDetailView class adding PaginationMixin,
MultipleObjectMixin and paginate_by:
class CabinetDetailView(PaginationMixin, MultipleObjectMixin, TemplateView):
template_name = 'cabinets/cabinet_details.html'
+ paginate_by = settings.COMMON_PAGINATE_BY
Replace the get_context_data function:
def get_context_data(self, **kwargs):
self.object_list = self.get_document_queryset()
try:
page = self.request.GET.get('page', 1)
except PageNotAnInteger:
page = 1
p = Paginator(self.object_list, self.paginate_by, request=self.
request)
document_list = p.page(page).object_list
data = super(CabinetDetailView, self).get_context_data(**kwargs)
cabinet = self.get_object()
data.update(
{
'jstree_data': '\n'.join(
jstree_data(node=cabinet.get_root(), selected_node=
cabinet)
),
'document_list': document_list,
'hide_links': True,
'list_as_items': True,
'object': cabinet,
'title': _('Details of cabinet: %s') % cabinet.get_full_path
(),
}
)
return data
Standard disclaimers: not rigorously tested, it works for me, your mileage
may vary
On Wednesday, January 24, 2018 at 8:31:46 AM UTC-5, LeVon Smoker wrote:
>
> Has anyone developed a patch to add pagination for the documents view when
> going in through the Cabinets menu / All / Details? We have a cabinet with
> over 1000 documents in it, and the page takes minutes (or the browser locks
> up) to render all of them documents/thumbnails.
>
--
---
You received this message because you are subscribed to the Google Groups
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.