|
6 | 6 | import tarfile |
7 | 7 | import urllib |
8 | 8 | from tempfile import mkstemp |
9 | | -from collections import OrderedDict |
| 9 | +from collections import OrderedDict, Counter |
10 | 10 | import csv |
11 | 11 | import json |
12 | 12 |
|
|
25 | 25 |
|
26 | 26 | from ietf.doc.models import Document, State |
27 | 27 | from ietf.group.models import Group |
| 28 | +from ietf.group.utils import can_manage_materials |
28 | 29 | from ietf.ietfauth.utils import role_required, has_role |
29 | 30 | from ietf.meeting.models import Meeting, Session, Schedule, Room |
30 | 31 | from ietf.meeting.helpers import get_areas, get_person_by_email, get_schedule_by_name |
@@ -844,21 +845,32 @@ def sort_key(session): |
844 | 845 | if not sessions: |
845 | 846 | raise Http404 |
846 | 847 |
|
| 848 | + type_counter = Counter() |
| 849 | + |
847 | 850 | for session in sessions: |
848 | 851 |
|
849 | 852 | ss = session.timeslotassignments.filter(schedule=meeting.agenda).order_by('timeslot__time') |
850 | 853 | if ss: |
851 | 854 | session.time = ', '.join(x.timeslot.time.strftime("%A %b-%d-%Y %H%M") for x in ss) |
| 855 | + if session.status.slug == 'canceled': |
| 856 | + session.time += " CANCELLED" |
852 | 857 | elif session.meeting.type_id=='interim': |
853 | 858 | session.time = session.meeting.date.strftime("%A %b-%d-%Y") |
| 859 | + if session.status.slug == 'canceled': |
| 860 | + session.time += " CANCELLED" |
854 | 861 | else: |
855 | | - session.time = 'Not yet scheduled' |
| 862 | + session.time = session.status.name |
856 | 863 |
|
857 | 864 | # TODO FIXME Deleted materials shouldn't be in the sessionpresentation_set |
858 | 865 | session.filtered_sessionpresentation_set = [p for p in session.sessionpresentation_set.all() if p.document.get_state_slug(p.document.type_id)!='deleted'] |
| 866 | + type_counter.update([p.document.type.slug for p in session.filtered_sessionpresentation_set]) |
| 867 | + |
| 868 | + can_manage = can_manage_materials(request.user, Group.objects.get(acronym=acronym)) |
859 | 869 |
|
860 | 870 | return render(request, "meeting/session_details.html", |
861 | 871 | { 'sessions':sessions , |
862 | 872 | 'meeting' :meeting , |
863 | 873 | 'acronym' :acronym, |
| 874 | + 'can_manage_materials' : can_manage, |
| 875 | + 'type_counter': type_counter, |
864 | 876 | }) |
0 commit comments