summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/views.py3
-rw-r--r--templates/packages/details.html6
2 files changed, 5 insertions, 4 deletions
diff --git a/packages/views.py b/packages/views.py
index ddb2adb6..604a7dcb 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -165,7 +165,8 @@ def flag(request, pkgid):
@login_required
def unflag(request, pkgid):
pkg = get_object_or_404(Package, id=pkgid)
- if pkg.maintainer.username != request.user.username:
+ if pkg.maintainer_id == 0 or \
+ pkg.maintainer.username != request.user.username:
return render_response(request, 'error_page.html', {'errmsg': 'You do not own this package.'})
pkg.needupdate = 0
pkg.save()
diff --git a/templates/packages/details.html b/templates/packages/details.html
index 65de079a..b1ba3433 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -11,9 +11,9 @@
<li>
{% if pkg.needupdate %}
<span style="font-size:x-small"><em>This package has been flagged out-of-date</em></span>
- {% if not user.is_anonymous %}{% if pkg.maintainer %}{% ifequal user.username pkg.maintainer.username %}
- <br />&nbsp; &nbsp; <a href="/packages/unflag/{{ pkg.id }}/">Click here to unflag</a>
- {% endifequal %}{% endif %}{% endif %}
+ {% if not user.is_anonymous %}
+ <br />&nbsp; &nbsp; <a href="/packages/unflag/{{ pkg.id }}/">Click here to unflag</a>
+ {% endif %}
{% else %}
<a href="/packages/flag/{{ pkg.id }}/" onclick="return !window.open('/packages/flag/{{ pkg.id }}/','FlagHelp','height=250,width=450,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no');">Flag Package Out-of-Date</a>
<a href="/packages/flaghelp" onclick="return !window.open('/packages/flaghelp','FlagHelp','height=250,width=450,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no');"><span style="font-size:x-small">(?)</span></a>