summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-12-03 13:27:12 -0600
committerDan McGee <dan@archlinux.org>2011-12-03 13:27:12 -0600
commit546012c8e0d9e757e4670dd14e41acb83eb4e997 (patch)
tree317e0e3b54e91b93fbad7df502ceb300a4036970
parentb2de5fec2bd112eb937dcb98b25685078cccdeb1 (diff)
Show files and directory count in standalone package files view
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/views/__init__.py4
-rw-r--r--templates/packages/files.html2
2 files changed, 5 insertions, 1 deletions
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index e3264161..b420ce60 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -169,9 +169,13 @@ def files(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
fileslist = PackageFile.objects.filter(pkg=pkg).order_by('directory', 'filename')
+ dir_count = sum(1 for f in fileslist if f.is_directory)
+ files_count = len(fileslist) - dir_count
context = {
'pkg': pkg,
'files': fileslist,
+ 'files_count': files_count,
+ 'dir_count': dir_count,
}
template = 'packages/files.html'
if request.is_ajax():
diff --git a/templates/packages/files.html b/templates/packages/files.html
index 50ab6e83..a564f726 100644
--- a/templates/packages/files.html
+++ b/templates/packages/files.html
@@ -8,9 +8,9 @@
<h2>Package File List: {{ pkg.pkgname }} {{ pkg.full_version }}</h2>
<div id="metadata">
<p><a href="{{ pkg.get_absolute_url }}">Back to Package</a></p>
+ <p>Package has {{ files_count }} file{{ files_count|pluralize }} and {{ dir_count }} director{{ dir_count|pluralize:"y,ies" }}.</p>
{% include "packages/files-list.html" %}
</div>
</div>
{% endblock %}
-