From 1271037974a771b2fdc775d97df983ca06cb1188 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 21 Mar 2011 00:59:47 -0400 Subject: [PATCH] Changed document statistic to fetch the id field and not the non existant pk field --- apps/documents/statistics.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/documents/statistics.py b/apps/documents/statistics.py index 110ca67e44..a9878f46ca 100644 --- a/apps/documents/statistics.py +++ b/apps/documents/statistics.py @@ -1,8 +1,10 @@ from django.utils.translation import ugettext as _ -from documents.conf.settings import STORAGE_BACKEND +from django.core.urlresolvers import reverse from common.utils import pretty_size, pretty_size_10 +from permissions.api import check_permissions +from documents.conf.settings import STORAGE_BACKEND from models import Document, DocumentType @@ -30,13 +32,14 @@ def storage_count(path=u'.'): def get_statistics(): - total_db_documents = Document.objects.only('pk',).count() + total_db_documents = Document.objects.only('id',).count() - paragraphs = [ _(u'Document types: %d') % DocumentType.objects.count(), - _(u'Documents in database: %d') % total_db_documents + _(u'Documents in database: %d') % total_db_documents, ] + + try: total_storage_documents, storage_used_space = storage_count() paragraphs.append(_(u'Documents in storage: %d') % total_storage_documents)