diff options
-rw-r--r-- | packages/views.py | 15 | ||||
-rw-r--r-- | templates/packages/details.html | 4 |
2 files changed, 18 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py index 604a7dcb..2b8f8b22 100644 --- a/packages/views.py +++ b/packages/views.py @@ -8,6 +8,8 @@ from django.contrib.auth.models import User from archweb_dev.lib.utils import validate, render_response from datetime import datetime from archweb_dev.packages.models import Package, PackageFile, Repo, Category +from django.core.exceptions import ObjectDoesNotExist + def update(request): if request.POST.has_key('adopt'): @@ -43,7 +45,18 @@ def details(request, pkgid=0, name='', repo=''): pkgid = p[0].id pkg = get_object_or_404(Package, id=pkgid) - return render_response(request, 'packages/details.html', {'pkg':pkg}) + origin_repo = None + if pkg.repo.name == 'Testing': + try: + origin_repo = Package.objects.filter( + pkgname__exact = pkg.pkgname).exclude( + repo__name__exact = pkg.repo.name).get().repo.name + except ObjectDoesNotExist: + origin_repo = None + return render_response( + request, + 'packages/details.html', + {'pkg': pkg, 'origin_repo': origin_repo}) def search(request, query=''): if request.GET.has_key('q'): diff --git a/templates/packages/details.html b/templates/packages/details.html index b1ba3433..a0e78210 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -6,7 +6,11 @@ <h2 class="title">{{ pkg.pkgname }} {{ pkg.pkgver }}-{{ pkg.pkgrel }}</h2> <div style="float:right" class="listing"> <ul class="small"> + {% if origin_repo %} + <li><a href="http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/{{ pkg.category.category }}/{{ pkg.pkgname }}/?cvsroot={{ origin_repo }}&only_with_tag=TESTING">View CVS Entries</a></li> + {% else %} <li><a href="http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/{{ pkg.category.category }}/{{ pkg.pkgname }}/?cvsroot={{ pkg.repo.name }}&only_with_tag=CURRENT">View CVS Entries</a></li> + {% endif %} <li><a href="/packages/files/{{ pkg.id }}/">View File List</a></li> <li> {% if pkg.needupdate %} |