diff options
author | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-08-10 23:35:48 +0200 |
---|---|---|
committer | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-08-10 23:35:48 +0200 |
commit | 6296b5ef2e678af278e3f9000dcd1732860e6149 (patch) | |
tree | 5cd4c17fa6990ffc8d34b5f07063fc13ab720ec4 /web/main | |
parent | Fixed error where failed deps didn't have logs (diff) | |
download | collagen-6296b5ef2e678af278e3f9000dcd1732860e6149.tar.gz collagen-6296b5ef2e678af278e3f9000dcd1732860e6149.tar.bz2 collagen-6296b5ef2e678af278e3f9000dcd1732860e6149.zip |
Made categories/packages sorted when browsing
Diffstat (limited to 'web/main')
-rw-r--r-- | web/main/views.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/web/main/views.py b/web/main/views.py index a1cafe0..3e5fe77 100644 --- a/web/main/views.py +++ b/web/main/views.py @@ -21,12 +21,13 @@ def browse(request, category_name=None, pkg_name=None): only_failed=True if not category_name and not pkg_name: if not only_failed: - cats = PackageCategory.objects.all() + cats = PackageCategory.objects.order_by('name') else: pprops = PackageProperties.objects.filter(error_code__gt=0) cats = set() for pprop in pprops: cats.add(pprop.packageversion.category) + cats = sorted(cats) return render_to_response('browse-categories.html', {'objects':cats,'failed': only_failed}) cat = PackageCategory.objects.get(name=category_name) if category_name and not pkg_name: @@ -37,10 +38,17 @@ def browse(request, category_name=None, pkg_name=None): if len(pprops) == 0 and only_failed: continue packages.add(pv.package.name) + packages = sorted(packages) return render_to_response('browse-categories.html',{'objects':packages,'category':cat, 'failed': only_failed}) pkg = Package.objects.get(name=pkg_name) pversions = PackageVersion.objects.filter(package=pkg, category=cat) + if only_failed: + pv_subset = [] + for pv in pversions: + if 0 < len(pv.packageproperties_set.filter(error_code__gt=0)): + pv_subset.append(pv) + pversions = pv_subset return render_to_response('view-package.html',{'pversions':pversions}) |