diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/urls.py | 2 | ||||
-rw-r--r-- | packages/views.py | 30 |
2 files changed, 17 insertions, 15 deletions
diff --git a/packages/urls.py b/packages/urls.py index da24ee03..c9006a12 100644 --- a/packages/urls.py +++ b/packages/urls.py @@ -11,7 +11,7 @@ package_patterns = patterns('packages.views', urlpatterns = patterns('packages.views', (r'^flaghelp/$', 'flaghelp'), - (r'^signoffs/$', 'signoffs'), + (r'^signoffs/$', 'signoffs', {}, 'package-signoffs'), (r'^signoff_package/(?P<arch>[A-z0-9]+)/(?P<pkgname>[A-z0-9\-+.]+)/$', 'signoff_package'), (r'^update/$', 'update'), diff --git a/packages/views.py b/packages/views.py index 77fa3a07..4e683144 100644 --- a/packages/views.py +++ b/packages/views.py @@ -1,18 +1,19 @@ from django import forms from django.contrib import messages +from django.contrib.admin.widgets import AdminDateWidget +from django.contrib.auth.models import User +from django.contrib.auth.decorators import permission_required from django.conf import settings from django.core.mail import send_mail -from django.template import loader, Context, RequestContext +from django.db.models import Q from django.http import HttpResponse, Http404 from django.shortcuts import get_object_or_404, redirect -from django.contrib.auth.models import User -from django.contrib.auth.decorators import permission_required -from django.contrib.admin.widgets import AdminDateWidget +from django.template import loader, Context, RequestContext +from django.utils import simplejson from django.views.decorators.cache import never_cache from django.views.decorators.vary import vary_on_headers from django.views.generic import list_detail from django.views.generic.simple import direct_to_template -from django.db.models import Q from datetime import datetime import string @@ -276,15 +277,16 @@ def signoff_package(request, arch, pkgname): pkgrel=pkg.pkgrel, packager=request.user) - if created: - messages.info(request, - "You have successfully signed off for %s on %s." % \ - (pkg.pkgname, pkg.arch)) - else: - messages.warning(request, - "You have already signed off for %s on %s." % \ - (pkg.pkgname, pkg.arch)) - return signoffs(request) + if request.is_ajax(): + data = { + 'created': created, + 'approved': pkg.approved_for_signoff(), + 'user': str(request.user), + } + return HttpResponse(simplejson.dumps(data), + mimetype='application/json') + + return redirect('package-signoffs') def flaghelp(request): return direct_to_template(request, 'packages/flaghelp.html') |