From 61ba8675abfdfba568878d50b0b4050ef32acaa5 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 10 Jan 2011 17:22:44 +0000 Subject: [PATCH] Shows if a request is pending --- groups/views.py | 4 +++- templates/groups/group_list.html | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/groups/views.py b/groups/views.py index dbf6616..86d20d2 100644 --- a/groups/views.py +++ b/groups/views.py @@ -51,7 +51,9 @@ def group_list(request): requestable = False fixed = not group.groupinformation.type == GROUP_TYPE_PERMISSION - group_list.append((group.id, group.name, status, requestable, fixed)) + pending = group.requests.filter(status=REQUEST_PENDING,user=request.user).count() + + group_list.append((group.id, group.name, status, requestable, fixed, pending)) return render_to_response('groups/group_list.html', locals(), context_instance=RequestContext(request)) diff --git a/templates/groups/group_list.html b/templates/groups/group_list.html index a5bb8f2..10c0a7f 100644 --- a/templates/groups/group_list.html +++ b/templates/groups/group_list.html @@ -9,9 +9,9 @@ {% if group_list %} -{% for id, group, status, requestable, fixed in group_list %} +{% for id, group, status, requestable, fixed, pending in group_list %} - +
Group NameStatusActions
{{ group }}{% if status %}{{ status }}{% endif %}{% if pending %}Request Pending{% else %}{% if status %}{{ status }}{% endif %}{% endif %} {% ifequal status None %}{% if requestable %}Request Membership{% endif %}{% endifequal %} {% if not fixed and status %}Leave {% endif %} {% if status == 'Admin' or request.user.is_superuser %}{% if not fixed %}Admin{% endif %}{% endif %}