summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-10-07 17:56:27 -0400
committerDusty Phillips <buchuki@gmail.com>2008-10-07 17:56:50 -0400
commit26dff01b41af5213ed9c630728592e5e6281c371 (patch)
tree86fd6c43ffcbab7e1b9c89466e668aebfbaf3c64
parentea4f886d6c9fb359ba7a2af2b006952c3420d37e (diff)
use user messages to communicate status
-rw-r--r--packages/views.py16
-rw-r--r--templates/base.html8
-rw-r--r--templates/status_page.html8
3 files changed, 16 insertions, 16 deletions
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.models import Arch, Repo, Signoff
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 @@
</div>
</div>
<div id="content">
+ {% if messages %}
+ <div class="box" style="width: 50%; text-align: center; margin-left: auto; margin-right: auto">
+ {% for message in messages %}
+ <p>{{message}}</p>
+ {% endfor %}
+ </div>
+ <br />
+ {% endif %}
{% block content %}
<div class="right">
{% 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 %}
- <div class="box">
- <h4>{{ message }}</h4>
- </div>
-{% endblock %}
-