Reorder general shepherd view. See #558

- Legacy-Id: 2732
This commit is contained in:
Emilio A. Sánchez López 2010-12-24 10:32:15 +00:00
parent 82a852a5d5
commit c5dd835e41
2 changed files with 73 additions and 33 deletions

View file

@ -34,23 +34,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{% endcomment %}
{% block wg_titledetail %}Documents{% endblock %}
{% block content %}
<div {% if concluded %}class="ietf-concluded-bg"{% endif %}>
{% block wg_content %}
<table class="ietf-table ietf-doctable" style="margin-top:16px;">
<tr>
<th class="title">Title</th>
<th class="title">Documents I shepherd</th>
<th class="date">Date</th>
<th class="status" colspan="2">Status</th>
<th class="status">Status</th>
<th class="ad">Area Director</th>
</tr>
{% for group, documents in groupped_documents.items %}
<tr class="header"><td colspan="5">{{ group }}</td></tr>
{% for doc in documents %}
{% for doc in my_documents %}
<tr class="{% cycle oddrow,evenrow %}">
<td class="title">
<a href="{% url doc_managing_shepherd wg.group_acronym.acronym doc %}">{{ doc.title }}</a>
@ -65,12 +59,64 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</tr>
{% endfor %}
{% endfor %}
</table>
<table class="ietf-table ietf-doctable" style="margin-top:16px;">
<tr>
<th class="title">Documents whithout shepherd</th>
<th class="date">Date</th>
<th class="status">Status</th>
<th class="ad">Area Director</th>
</tr>
{% for doc in no_shepherd %}
<tr class="{% cycle oddrow,evenrow %}">
<td class="title">
<a href="{% url doc_managing_shepherd wg.group_acronym.acronym doc %}">{{ doc.title }}</a>
</td>
<td class="date">
{{ doc.status.start_date|date:"Y-m" }}
</td>
<td class="status">
{{ doc.status.status }}
</td>
<td class="ad">{{ doc.ad_name|default:"" }}</td>
</tr>
{% endfor %}
</table>
<table class="ietf-table ietf-doctable" style="margin-top:16px;">
<tr>
<th class="title">Documents by other shepherds</th>
<th class="date">Date</th>
<th class="status">Status</th>
<th class="ad">Area Director</th>
</tr>
{% regroup other_shepherds by shepherd as regrouped %}
{% for documents in regrouped %}
<tr class="header"><td colspan="4">{{ documents.grouper }}</td></tr>
{% for doc in documents.list %}
<tr class="{% cycle oddrow,evenrow %}">
<td class="title">
<a href="{% url doc_managing_shepherd wg.group_acronym.acronym doc %}">{{ doc.title }}</a>
</td>
<td class="date">
{{ doc.status.start_date|date:"Y-m" }}
</td>
<td class="status">
{{ doc.status.status }}
</td>
<td class="ad">{{ doc.ad_name|default:"" }}</td>
</tr>
{% endfor %}
{% endfor %}
</table>
{% endblock wg_content %}
</div>
{% endblock content %}

View file

@ -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))