From c5dd835e410c0af11e0bf9f67b4d1c74ccf82407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20A=2E=20S=C3=A1nchez=20L=C3=B3pez?= Date: Fri, 24 Dec 2010 10:32:15 +0000 Subject: [PATCH] Reorder general shepherd view. See #558 - Legacy-Id: 2732 --- .../wgchairs/wg_shepherd_documents.html | 76 +++++++++++++++---- ietf/wgchairs/views.py | 30 +++----- 2 files changed, 73 insertions(+), 33 deletions(-) diff --git a/ietf/templates/wgchairs/wg_shepherd_documents.html b/ietf/templates/wgchairs/wg_shepherd_documents.html index 5c76b0300..8d0487afa 100644 --- a/ietf/templates/wgchairs/wg_shepherd_documents.html +++ b/ietf/templates/wgchairs/wg_shepherd_documents.html @@ -34,23 +34,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {% endcomment %} {% block wg_titledetail %}Documents{% endblock %} -{% block content %} -
- - {% block wg_content %} + - + - + - {% for group, documents in groupped_documents.items %} - - - {% for doc in documents %} + {% for doc in my_documents %} {% endfor %} - {% endfor %}
TitleDocuments I shepherd DateStatusStatus Area Director
{{ group }}
{{ doc.title }} @@ -65,12 +59,64 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- + + + + + + + + + + {% for doc in no_shepherd %} + + + + + + + + {% endfor %} + +
Documents whithout shepherdDateStatusArea Director
+ {{ doc.title }} + + {{ doc.status.start_date|date:"Y-m" }} + + {{ doc.status.status }} + {{ doc.ad_name|default:"" }}
+ + + + + + + + + + {% regroup other_shepherds by shepherd as regrouped %} + {% for documents in regrouped %} + + + + {% for doc in documents.list %} + + + + + + + + {% endfor %} + {% endfor %} +
Documents by other shepherdsDateStatusArea Director
{{ documents.grouper }}
+ {{ doc.title }} + + {{ doc.status.start_date|date:"Y-m" }} + + {{ doc.status.status }} + {{ doc.ad_name|default:"" }}
{% endblock wg_content %} -
-{% endblock content %} - diff --git a/ietf/wgchairs/views.py b/ietf/wgchairs/views.py index f04a36298..e2229aeab 100644 --- a/ietf/wgchairs/views.py +++ b/ietf/wgchairs/views.py @@ -3,12 +3,11 @@ from django.shortcuts import get_object_or_404, render_to_response from django.template import RequestContext from django.http import HttpResponseForbidden +from ietf.idrfc.views_search import SearchForm, search_query from ietf.wgchairs.forms import (RemoveDelegateForm, add_form_factory, ManagingShepherdForm) from ietf.wgchairs.accounts import (can_manage_delegates_in_group, get_person_for_user, can_manage_shepherds_in_group) -from ietf.ietfworkflows.utils import get_workflow_for_wg -from django.db.models import Q def manage_delegates(request, acronym): @@ -35,15 +34,6 @@ def manage_delegates(request, acronym): }, RequestContext(request)) -def manage_workflow(request, acronym): - wg = get_object_or_404(IETFWG, group_acronym__acronym=acronym, group_type=1) - workflow = get_workflow_for_wg(wg) - return render_to_response('wgchairs/manage_workflow.html', - {'wg': wg, - 'workflow': workflow, - }, RequestContext(request)) - - def managing_shepherd(request, acronym, name): """ View for managing the assigned shepherd of a document. @@ -71,16 +61,20 @@ def wg_shepherd_documents(request, acronym): return HttpResponseForbidden('You have no permission to access this view') current_person = get_person_for_user(user) - base_qs = InternetDraft.objects.select_related('status') + form = SearchForm({'by':'group', 'group':str(wg.group_acronym.acronym), + 'activeDrafts':'on'}) + if not form.is_valid(): + raise ValueError("form did not validate") + (docs,meta) = search_query(form.cleaned_data) + + base_qs = InternetDraft.objects.filter(pk__in=[i.id._draft.pk for i in docs if i.id]).select_related('status') documents_no_shepherd = base_qs.filter(shepherd__isnull=True) documents_my = base_qs.filter(shepherd=current_person) - documents_other = base_qs.filter(~Q(shepherd=current_person)) + documents_other = base_qs.exclude(shepherd__isnull=True).exclude(shepherd__pk__in=[current_person.pk, 0]) context = { - 'groupped_documents': { - 'Documents without Shepherd': documents_no_shepherd, - 'My documents': documents_my, - 'Other documents': documents_other, - }, + 'no_shepherd': documents_no_shepherd, + 'my_documents': documents_my, + 'other_shepherds': documents_other, 'wg': wg, } return render_to_response('wgchairs/wg_shepherd_documents.html', context, RequestContext(request))