From e26c6c190590df18df82e300712d04e05c9ca2d0 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 11 Oct 2014 03:47:56 -0400 Subject: [PATCH] Use the page_count method which can cache the result --- mayan/apps/documents/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/apps/documents/forms.py b/mayan/apps/documents/forms.py index 4141a06f08..36396c58db 100644 --- a/mayan/apps/documents/forms.py +++ b/mayan/apps/documents/forms.py @@ -87,7 +87,7 @@ class DocumentPreviewForm(forms.Form): super(DocumentPreviewForm, self).__init__(*args, **kwargs) self.fields['preview'].initial = document try: - self.fields['preview'].label = _(u'Document pages (%d)') % document.pages.count() + self.fields['preview'].label = _(u'Document pages (%d)') % document.page_count except AttributeError: self.fields['preview'].label = _(u'Document pages (%d)') % 0