diff options
author | Dan McGee <dan@archlinux.org> | 2010-05-26 09:30:43 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-05-26 09:30:43 -0500 |
commit | 277117ba34204995efac766b715fe62270a5e908 (patch) | |
tree | 2475175f1dcce2c01be09320d5ce1e1977a4ad79 | |
parent | 8f11dd9065319c5b49fad82c3546d1c291db78fc (diff) |
Move package flagging URLs below the package
We were still using the user-facing package IDs here which we have
eliminated everywhere else Change it to use the same user-friendly URL
pattern we are using elsewhere.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | packages/views.py | 10 | ||||
-rw-r--r-- | templates/packages/details.html | 4 | ||||
-rw-r--r-- | urls.py | 10 |
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 /> <a href="/packages/unflag/{{ pkg.id }}/" + <br /> <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', @@ -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'), |