|
51 | 51 | from django.contrib.sites.models import Site |
52 | 52 |
|
53 | 53 |
|
54 | | -from ietf.doc.models import Document, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES |
| 54 | +from ietf.doc.models import Document, State, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES |
55 | 55 | from ietf.doc.utils import update_telechat, augment_events_with_revision |
56 | 56 | from ietf.group.models import GroupMilestone, Role |
57 | 57 | 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): |
179 | 179 |
|
180 | 180 | return HttpResponse(json.dumps(res, indent=2), content_type='text/plain') |
181 | 181 |
|
| 182 | +# def past_agendas(request): |
| 183 | +# # This is not particularly useful with the current way of constructing |
| 184 | +# # an agenda, because the code and data strucutes assume we're showing |
| 185 | +# # the current agenda, and documents on later agendas won't show on |
| 186 | +# # earlier agendas, even if they were actually on them. |
| 187 | +# telechat_dates = TelechatDate.objects.filter(date__lt=datetime.date.today(), date__gte=datetime.date(2012,3,1)) |
| 188 | +# return render(request, 'iesg/past_agendas.html', {'telechat_dates': telechat_dates }) |
| 189 | + |
182 | 190 | def agenda(request, date=None): |
183 | 191 | data = agenda_data(date) |
184 | 192 |
|
@@ -380,6 +388,41 @@ def agenda_documents(request): |
380 | 388 | request.session['ballot_edit_return_point'] = request.path_info |
381 | 389 | return render(request, 'iesg/agenda_documents.html', { 'telechats': telechats }) |
382 | 390 |
|
| 391 | +def past_documents(request): |
| 392 | + iesg_state_slugs = ('approved', 'iesg-eva') |
| 393 | + iesg_states = State.objects.filter(type='draft-iesg', slug__in=iesg_state_slugs) |
| 394 | + possible_docs = Document.objects.filter(models.Q(states__type="draft-iesg", |
| 395 | + states__slug__in=iesg_state_slugs) | |
| 396 | + models.Q(states__type__in=("statchg", "conflrev"), |
| 397 | + states__slug__in=("appr-pr", )), |
| 398 | + ) |
| 399 | + possible_docs = possible_docs.select_related("stream", "group", "ad").distinct() |
| 400 | + |
| 401 | + docs = [] |
| 402 | + for doc in possible_docs: |
| 403 | + ballot = doc.latest_ballot() |
| 404 | + blocking_positions = [] |
| 405 | + if ballot: |
| 406 | + blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking] |
| 407 | + if blocking_positions: |
| 408 | + augment_events_with_revision(doc, blocking_positions) |
| 409 | + |
| 410 | + doc.by_me = bool([p for p in blocking_positions if user_is_person(request.user, p.ad)]) |
| 411 | + doc.for_me = user_is_person(request.user, doc.ad) |
| 412 | + doc.milestones = doc.groupmilestone_set.filter(state="active").order_by("time").select_related("group") |
| 413 | + doc.blocking_positions = blocking_positions |
| 414 | + doc.telechat = doc.previous_telechat_date() |
| 415 | + |
| 416 | + if doc.telechat: |
| 417 | + docs.append(doc) |
| 418 | + |
| 419 | + # latest first |
| 420 | + #docs.sort(key=lambda d: d.latest_event().time, reverse=True) |
| 421 | + docs.sort(key=lambda d: d.telechat, reverse=True) |
| 422 | + |
| 423 | + return render(request, 'iesg/past_documents.html', { 'docs': docs, 'states': iesg_states }) |
| 424 | + |
| 425 | + |
383 | 426 | def telechat_docs_tarfile(request, date): |
384 | 427 | date = get_agenda_date(date) |
385 | 428 |
|
|
0 commit comments