From 26dff01b41af5213ed9c630728592e5e6281c371 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Tue, 7 Oct 2008 17:56:27 -0400 Subject: use user messages to communicate status --- packages/views.py | 16 ++++++++-------- templates/base.html | 8 ++++++++ templates/status_page.html | 8 -------- 3 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 templates/status_page.html diff --git a/packages/views.py b/packages/views.py index eaef72f6..4491342f 100644 --- a/packages/views.py +++ b/packages/views.py @@ -15,22 +15,22 @@ from archweb_dev.main.utils import make_choice def update(request): + ids = request.POST.getlist('pkgid') if request.POST.has_key('adopt'): mode = 'adopt' - message = 'Adoption was successful' + maint_id = request.user.id if request.POST.has_key('disown'): mode = 'disown' - message = 'Disown was successful' + maint_id = 0 - ids = request.POST.getlist('pkgid') for id in ids: pkg = Package.objects.get(id=id) - if mode == 'adopt': - pkg.maintainer = request.user - elif mode == 'disown': - pkg.maintainer_id = 0 + pkg.maintainer_id = maint_id pkg.save() - return render_response(request, 'status_page.html', {'message':message}) + + request.user.message_set.create(message="%d packages %sed" % ( + len(ids), mode)) + return HttpResponseRedirect('/packages/search/') def details(request, pkgid=0, name='', repo='', arch=''): if pkgid != 0: diff --git a/templates/base.html b/templates/base.html index b060da20..4abc538b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -40,6 +40,14 @@
+ {% if messages %} +
+ {% for message in messages %} +

{{message}}

+ {% endfor %} +
+
+ {% endif %} {% block content %}
{% block content_right %} diff --git a/templates/status_page.html b/templates/status_page.html deleted file mode 100644 index 558c6544..00000000 --- a/templates/status_page.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -
-

{{ message }}

-
-{% endblock %} - -- cgit v1.2.3-54-g00ecf