diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-08-16 13:36:15 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-08-16 13:36:15 -0400 |
commit | ac63cc4101da73e5b1b4424c53f29033557c6596 (patch) | |
tree | 34e02c6288290f93d5a8be2d13e7183d77a1690a /packages/views.py | |
parent | e1fa499f637e00f5e7eb91ec460903558b46017a (diff) |
#10340 Integrated Signoffs completed but untested
Diffstat (limited to 'packages/views.py')
-rw-r--r-- | packages/views.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/packages/views.py b/packages/views.py index 4fec2558..8210353e 100644 --- a/packages/views.py +++ b/packages/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.models import User from datetime import datetime from archweb_dev.main.utils import validate, render_response from archweb_dev.main.models import Package, PackageFile, PackageDepend -from archweb_dev.main.models import Arch, Repo +from archweb_dev.main.models import Arch, Repo, Signoff from django.core.exceptions import ObjectDoesNotExist @@ -145,10 +145,32 @@ def unflag(request, pkgid): pkg.save() return HttpResponseRedirect('/packages/%d/' % (pkg.id)) -def signoffs(request): +def signoffs(request, message=None): packages = Package.objects.filter(repo__name="Testing").order_by("pkgname") return render_response(request, 'packages/signoffs.html', - {'packages': packages}) + {'packages': packages, 'message': message}) + +def signoff_package(request, arch, pkgname): + pkg = get_object_or_404(Package, + arch__name=arch, + pkgname=pkgname, + repo__name="Testing") + + signoff, created = Signoff.objects.get_or_create( + pkg=pkg, + pkgver=pkg.pkgver, + pkgrel=pkg.pkgrel, + packager=request.user) + + if created: + message = "You have successfully signed off for %s on %s" % ( + pkg.pkgname, pkg.arch) + else: + message = "You have already signed off for %s on %s" % ( + pkg.pkgname, pkg.arch) + + return signoffs(request, message) + # vim: set ts=4 sw=4 et: |