summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/urls.py1
-rw-r--r--packages/views.py13
2 files changed, 14 insertions, 0 deletions
diff --git a/packages/urls.py b/packages/urls.py
index 37ce23c0..638a370a 100644
--- a/packages/urls.py
+++ b/packages/urls.py
@@ -26,6 +26,7 @@ urlpatterns = patterns('packages.views',
(r'^differences/$', 'arch_differences'),
(r'^stale_relations/$', 'stale_relations'),
+ (r'^stale_relations/update/$','stale_relations_update'),
(r'^(?P<name>[A-z0-9\-+.]+)/$',
'details'),
diff --git a/packages/views.py b/packages/views.py
index 9a2094aa..1ab04258 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -11,6 +11,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.template import loader, Context, RequestContext
from django.utils import simplejson
from django.views.decorators.cache import never_cache
+from django.views.decorators.http import require_POST
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
@@ -36,6 +37,7 @@ def opensearch(request):
mimetype='application/opensearchdescription+xml')
@permission_required('main.change_package')
+@require_POST
def update(request):
ids = request.POST.getlist('pkgid')
count = 0
@@ -418,4 +420,15 @@ def stale_relations(request):
}
return direct_to_template(request, 'packages/stale_relations.html', context)
+@permission_required('packages.delete_packagerelation')
+@require_POST
+def stale_relations_update(request):
+ ids = set(request.POST.getlist('relation_id'))
+
+ if ids:
+ PackageRelation.objects.filter(id__in=ids).delete()
+
+ messages.info(request, "%d package relations deleted." % len(ids))
+ return redirect('/packages/stale_relations/')
+
# vim: set ts=4 sw=4 et: