Added a 'Recent documents' to the IESG pages.

- Legacy-Id: 14300
This commit is contained in:
Henrik Levkowetz 2017-11-04 12:36:13 +00:00
parent 77d5f1c155
commit 8499beb010
8 changed files with 77 additions and 20 deletions

2
PLAN
View file

@ -7,8 +7,6 @@ Updated: $Date$
Planned work in rough order
===========================
* Add a 'recent ballots' page (IESG request)
* Add email thread search links to IESG ballots.
* Add an API to post IESG ballot comments

View file

@ -344,9 +344,14 @@ class DocumentInfo(models.Model):
e = self.latest_event(BallotDocEvent, ballot_type__slug=ballot_type_slug)
return e and not e.type == "closed_ballot"
def latest_ballot(self):
"""Returns the most recently created ballot"""
ballot = self.latest_event(BallotDocEvent, type__in=("created_ballot", "closed_ballot"))
return ballot
def active_ballot(self):
"""Returns the most recently created ballot if it isn't closed."""
ballot = self.latest_event(BallotDocEvent, type__in=("created_ballot", "closed_ballot"))
ballot = self.latest_ballot()
if ballot and ballot.type == "created_ballot":
return ballot
else:
@ -649,9 +654,15 @@ class Document(DocumentInfo):
return e.telechat_date if e and e.telechat_date and e.telechat_date >= datetime.date.today() else None
def past_telechat_date(self):
"Return the latest telechat date if it isn't in the future; else None"
e = self.latest_event(TelechatDocEvent, type="scheduled_for_telechat")
return e.telechat_date if e and e.telechat_date and e.telechat_date < datetime.date.today() else None
def previous_telechat_date(self):
"Return the most recent telechat date in the past, if any (even if there's another in the future)"
e = self.latest_event(TelechatDocEvent, type="scheduled_for_telechat", telechat_date__lt=datetime.datetime.now())
return e.telechat_date if e else None
def area_acronym(self):
g = self.group
if g:

View file

@ -53,6 +53,7 @@ urlpatterns = [
url(r'^agenda/documents.txt$', views.agenda_documents_txt),
url(r'^agenda/documents/$', views.agenda_documents),
url(r'^past/documents/$', views.past_documents),
url(r'^agenda/telechat-(?:%(date)s-)?docs.tgz' % settings.URL_REGEXPS, views.telechat_docs_tarfile),
url(r'^discusses/$', views.discusses),
url(r'^milestones/$', views.milestones_needing_review),

View file

@ -51,7 +51,7 @@ from django.shortcuts import render, redirect
from django.contrib.sites.models import Site
from ietf.doc.models import Document, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES
from ietf.doc.models import Document, State, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES
from ietf.doc.utils import update_telechat, augment_events_with_revision
from ietf.group.models import GroupMilestone, Role
from ietf.iesg.agenda import agenda_data, agenda_sections, fill_in_agenda_docs, get_agenda_date
@ -179,6 +179,14 @@ def agenda_json(request, date=None):
return HttpResponse(json.dumps(res, indent=2), content_type='text/plain')
# def past_agendas(request):
# # This is not particularly useful with the current way of constructing
# # an agenda, because the code and data strucutes assume we're showing
# # the current agenda, and documents on later agendas won't show on
# # earlier agendas, even if they were actually on them.
# telechat_dates = TelechatDate.objects.filter(date__lt=datetime.date.today(), date__gte=datetime.date(2012,3,1))
# return render(request, 'iesg/past_agendas.html', {'telechat_dates': telechat_dates })
def agenda(request, date=None):
data = agenda_data(date)
@ -380,6 +388,41 @@ def agenda_documents(request):
request.session['ballot_edit_return_point'] = request.path_info
return render(request, 'iesg/agenda_documents.html', { 'telechats': telechats })
def past_documents(request):
iesg_state_slugs = ('approved', 'iesg-eva')
iesg_states = State.objects.filter(type='draft-iesg', slug__in=iesg_state_slugs)
possible_docs = Document.objects.filter(models.Q(states__type="draft-iesg",
states__slug__in=iesg_state_slugs) |
models.Q(states__type__in=("statchg", "conflrev"),
states__slug__in=("appr-pr", )),
)
possible_docs = possible_docs.select_related("stream", "group", "ad").distinct()
docs = []
for doc in possible_docs:
ballot = doc.latest_ballot()
blocking_positions = []
if ballot:
blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking]
if blocking_positions:
augment_events_with_revision(doc, blocking_positions)
doc.by_me = bool([p for p in blocking_positions if user_is_person(request.user, p.ad)])
doc.for_me = user_is_person(request.user, doc.ad)
doc.milestones = doc.groupmilestone_set.filter(state="active").order_by("time").select_related("group")
doc.blocking_positions = blocking_positions
doc.telechat = doc.previous_telechat_date()
if doc.telechat:
docs.append(doc)
# latest first
#docs.sort(key=lambda d: d.latest_event().time, reverse=True)
docs.sort(key=lambda d: d.telechat, reverse=True)
return render(request, 'iesg/past_documents.html', { 'docs': docs, 'states': iesg_states })
def telechat_docs_tarfile(request, date):
date = get_agenda_date(date)

View file

@ -25,10 +25,11 @@
<h1>IESG agenda: {{ date }} </h1>
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="/iesg/agenda/">IESG Agenda</a></li>
<li class=" "><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
<li class=" "><a href="/iesg/discusses/">DISCUSS positions</a></li>
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
<li class="active"><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
</ul>
{% for num, section in sections %}

View file

@ -23,10 +23,11 @@
<h1>Documents on future IESG telechat agendas</h1>
<ul class="nav nav-tabs" role="tablist">
<li class=" "><a href="/iesg/agenda/">IESG Agenda</a></li>
<li class="active"><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
<li class=" "><a href="/iesg/discusses/">DISCUSS positions</a></li>
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
<li class="active"><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
</ul>

View file

@ -16,10 +16,11 @@
<h1>IESG discuss positions</h1>
<ul class="nav nav-tabs" role="tablist">
<li class=" "><a href="/iesg/agenda/">IESG Agenda</a></li>
<li class=" "><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
<li class="active"><a href="/iesg/discusses/">DISCUSS positions</a></li>
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
<li class="active"><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
</ul>

View file

@ -19,10 +19,11 @@
<h1>{{ group_type | upper }} {{ role }} Photos</h1>
<ul class="nav nav-tabs" role="tablist">
<li ><a href="/iesg/agenda/documents/">IESG Agenda</a></li>
<li ><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
<li ><a href="/iesg/discusses/">DISCUSS positions</a></li>
<li class="active"><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
<li class="active"><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
</ul>
{% regroup roles by group.acronym as alphabet_blocks %}