summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/views.py10
-rw-r--r--templates/packages/details.html4
-rw-r--r--urls.py10
3 files changed, 14 insertions, 10 deletions
diff --git a/packages/views.py b/packages/views.py
index fc366988..682ddedf 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -205,8 +205,9 @@ def files(request, name='', repo='', arch=''):
return render_to_response(template, RequestContext(request, {'pkg':pkg,'files':files}))
@permission_required('main.change_package')
-def unflag(request, pkgid):
- pkg = get_object_or_404(Package, id=pkgid)
+def unflag(request, name='', repo='', arch=''):
+ pkg = get_object_or_404(Package,
+ pkgname=name, repo__name__iexact=repo, arch__name=arch)
pkg.needupdate = 0
pkg.save()
return HttpResponseRedirect(pkg.get_absolute_url())
@@ -263,8 +264,9 @@ class FlagForm(forms.Form):
widget=forms.TextInput(attrs={'style': 'display:none;'}),
required=False)
-def flag(request, pkgid):
- pkg = get_object_or_404(Package, id=pkgid)
+def flag(request, name='', repo='', arch=''):
+ pkg = get_object_or_404(Package,
+ pkgname=name, repo__name__iexact=repo, arch__name=arch)
context = {'pkg': pkg}
if pkg.needupdate == 1:
# already flagged. do nothing.
diff --git a/templates/packages/details.html b/templates/packages/details.html
index 192dce82..88ee4539 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -16,11 +16,11 @@
{% if pkg.needupdate %}
<span class="flagged">This package has been flagged out-of-date</span>
{% if user.is_authenticated %}
- <br />&nbsp; &nbsp; <a href="/packages/unflag/{{ pkg.id }}/"
+ <br />&nbsp; &nbsp; <a href="unflag/"
title="Unflag this package">Click here to unflag</a>
{% endif %}
{% else %}
- <a href="/packages/flag/{{ pkg.id }}/" title="Flag {{ pkg.pkgname }} as out-of-date">Flag Package Out-of-Date</a>
+ <a href="flag/" title="Flag {{ pkg.pkgname }} as out-of-date">Flag Package Out-of-Date</a>
<a href="/packages/flaghelp/"
title="Get help on package flagging"
onclick="return !window.open('/packages/flaghelp','FlagHelp',
diff --git a/urls.py b/urls.py
index ecdc31e9..c52f6abb 100644
--- a/urls.py
+++ b/urls.py
@@ -25,13 +25,11 @@ sitemaps = {
admin.autodiscover()
urlpatterns = patterns('',
- (r'^packages/flag/(\d+)/$', 'packages.views.flag'),
(r'^packages/flaghelp/$', 'packages.views.flaghelp'),
- (r'^packages/unflag/(\d+)/$', 'packages.views.unflag'),
- (r'^packages/signoffs/$', 'packages.views.signoffs'),
+ (r'^packages/signoffs/$', 'packages.views.signoffs'),
(r'^packages/signoff_package/(?P<arch>[A-z0-9]+)/(?P<pkgname>[A-z0-9\-+.]+)/$',
'packages.views.signoff_package'),
- (r'^packages/update/$', 'packages.views.update'),
+ (r'^packages/update/$', 'packages.views.update'),
# Preference is for the packages/ url below, but search is kept
# because other projects link to it
@@ -50,6 +48,10 @@ urlpatterns = patterns('',
'packages.views.files'),
(r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/maintainer/$',
'packages.views.getmaintainer'),
+ (r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/flag/$',
+ 'packages.views.flag'),
+ (r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/unflag/$',
+ 'packages.views.unflag'),
(r'^todo/(\d+)/$', 'todolists.views.view'),
(r'^todo/add/$', 'todolists.views.add'),