summaryrefslogtreecommitdiff
path: root/packages/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-03 19:10:07 -0500
committerDan McGee <dan@archlinux.org>2011-11-03 19:10:07 -0500
commit8187b87143081a2be75032db91287f9deb9d1f89 (patch)
tree3da2e4f1c38caa2e8f1069daa94c42a73343b535 /packages/views.py
parente3e3e498765ab416a2902adf114cd3270e3eb12e (diff)
Add signoff options form and data entry page
This allows the criteria and other information about certain signoffs to be overridden as necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views.py')
-rw-r--r--packages/views.py40
1 files changed, 39 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py
index e102760b..66bcd3fc 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -25,7 +25,7 @@ from urllib import urlencode
from main.models import Package, PackageFile, Arch, Repo
from main.utils import make_choice
from mirrors.models import MirrorUrl
-from .models import PackageRelation, PackageGroup, Signoff
+from .models import PackageRelation, PackageGroup, SignoffSpecification, Signoff
from .utils import (get_group_info, get_differences_info,
get_wrong_permissions, get_signoff_groups, approved_by_signoffs)
@@ -417,6 +417,44 @@ def signoff_package(request, name, repo, arch, revoke=False):
return redirect('package-signoffs')
+class SignoffOptionsForm(forms.ModelForm):
+ class Meta:
+ model = SignoffSpecification
+ fields = ('required', 'enabled', 'known_bad', 'comments')
+
+@permission_required('main.change_package')
+@never_cache
+def signoff_options(request, name, repo, arch):
+ packages = get_list_or_404(Package, pkgbase=name,
+ arch__name=arch, repo__name__iexact=repo, repo__testing=True)
+ package = packages[0]
+
+ # TODO ensure submitter is maintainer and/or packager
+
+ try:
+ spec = SignoffSpecification.objects.get_from_package(package)
+ except SignoffSpecification.DoesNotExist:
+ # create a fake one, but don't save it just yet
+ spec = SignoffSpecification(pkgbase=package.pkgbase,
+ pkgver=package.pkgver, pkgrel=package.pkgrel,
+ epoch=package.epoch, arch=package.arch, repo=package.repo)
+ spec.user = request.user
+
+ if request.POST:
+ form = SignoffOptionsForm(request.POST, instance=spec)
+ if form.is_valid():
+ form.save()
+ return redirect('package-signoffs')
+ else:
+ form = SignoffOptionsForm(instance=spec)
+
+ context = {
+ 'packages': packages,
+ 'package': package,
+ 'form': form,
+ }
+ return direct_to_template(request, 'packages/signoff_options.html', context)
+
def flaghelp(request):
return direct_to_template(request, 'packages/flaghelp.html')