From c92da0ed5e33a4c05ac0f57034c5676b7a097d63 Mon Sep 17 00:00:00 2001
From: Michael Lee
Date: Wed, 31 Oct 2007 15:47:57 +0000
Subject: [PATCH] To resolve ticket #237 * view.py passes two queries for
sessions: one with day_id <= 0 (pre session) and the other with day_id > 0
(regular sessions) to the meeting agenda templates - Legacy-Id: 965
---
ietf/meeting/views.py | 8 +++-----
ietf/templates/meeting/agenda.html | 19 ++++++++++++++-----
ietf/templates/meeting/agenda.txt | 22 ++++++++++++++++++----
3 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py
index 0f3fc859cc..a372b8b575 100644
--- a/ietf/meeting/views.py
+++ b/ietf/meeting/views.py
@@ -37,7 +37,8 @@ def show_html_materials(request, meeting_num=None):
def show_html_agenda(request, meeting_num=None, html_or_txt=None):
if html_or_txt == 'txt':
return HttpResponsePermanentRedirect('http://www.ietf.org/meetings/agenda_%d.txt' % int(meeting_num))
- queryset_list=MeetingTime.objects.filter(meeting=meeting_num).exclude(day_id=0).order_by("day_id","time_desc")
+ queryset_list=MeetingTime.objects.filter(meeting=meeting_num,day_id__gt='0').order_by("day_id","time_desc")
+ queryset_list_pre_session=MeetingTime.objects.filter(meeting=meeting_num,day_id__lte='0').order_by("day_id","time_desc")
meeting_info=get_object_or_404(Meeting, meeting_num=meeting_num)
nonsession_info=NonSession.objects.filter(meeting=meeting_num,day_id__gte='0').order_by("day_id")
meetingvenue_info=get_object_or_404(MeetingVenue, meeting_num=meeting_num)
@@ -73,10 +74,7 @@ def show_html_agenda(request, meeting_num=None, html_or_txt=None):
# [133] is broken because it requires a patched Django to run. Work
# around this instead. Later: FIXME (revert to the straightforward code
# when this bug has been fixed in the Django release we're running.)
- ## queryset_list_sun=WgMeetingSession.objects.filter(meeting=meeting_num, sched_time_id1__day_id=0).order_by('sched_time_id1__time_desc')
- queryset_list_sun=list(WgMeetingSession.objects.filter(meeting=meeting_num, sched_time_id1__day_id=0))
- queryset_list_sun.sort(key=(lambda item: item.sched_time_id1.time_desc))
queryset_list_ads = list(IESGHistory.objects.filter(meeting=meeting_num))
queryset_list_ads.sort(key=(lambda item: item.area.area_acronym.acronym))
- return object_list(request,queryset=queryset_list, template_name=template_file,allow_empty=True, extra_context={'qs_sun':queryset_list_sun, 'meeting_info':meeting_info, 'meeting_num':meeting_num, 'nonsession_info':nonsession_info, 'meetingvenue_info':meetingvenue_info, 'plenaryw_agenda':plenaryw_agenda, 'plenaryt_agenda':plenaryt_agenda, 'qs_ads':queryset_list_ads,'last_update_info':last_update_info})
+ return object_list(request,queryset=queryset_list, template_name=template_file,allow_empty=True, extra_context={'queryset_list_pre_session':queryset_list_pre_session, 'meeting_info':meeting_info, 'meeting_num':meeting_num, 'nonsession_info':nonsession_info, 'meetingvenue_info':meetingvenue_info, 'plenaryw_agenda':plenaryw_agenda, 'plenaryt_agenda':plenaryt_agenda, 'qs_ads':queryset_list_ads,'last_update_info':last_update_info})
diff --git a/ietf/templates/meeting/agenda.html b/ietf/templates/meeting/agenda.html
index c546509f88..262e678fe6 100644
--- a/ietf/templates/meeting/agenda.html
+++ b/ietf/templates/meeting/agenda.html
@@ -16,13 +16,22 @@
*** Click on an acronym of the group to get a charter page ***
*** Click on a name of the group to get a meeting agenda ***
-{{ meeting_info.start_date|date:"l"|upper }}, {{ meeting_info.start_date|date:"F j, Y" }}
-{{ nonsession_info.0.time_desc }} {{ nonsession_info.0.non_session_ref }} - {{ meetingvenue_info.reg_area_name }}
+
+{% regroup queryset_list_pre_session by day_id as pre_days %}
+{% for pre_day in pre_days %}
+ {{ pre_day.list.0.meeting_date|date:"l"|upper }}, {{ pre_day.list.0.meeting_date|date:"F j, Y" }}
+ {% ifequal pre_day.list.0.day_id 0 %}
+ {{ nonsession_info.0.time_desc }} {{ nonsession_info.0.non_session_ref }} - {{ meetingvenue_info.reg_area_name }}
-{% for item in qs_sun %}
-{{ item.sched_time_id1.time_desc }} {{ item.acronym_name }} - {{ item.sched_room_id1.room_name }}
+ {% endifequal %}
+ {% for item in pre_day.list %}
+ {% for session in item.sessions %}
+ {{ item.time_desc }} {{ session.acronym_name }} - {{ session.sched_room_id1.room_name }}
+ {% endfor %}
+ {% endfor %}
+
{% endfor %}
-
+
{% regroup object_list by day_id as days %}
{% for day in days %}
{{ day.list.0.meeting_date|date:"l"|upper }}, {{ day.list.0.meeting_date|date:"F j, Y" }}
diff --git a/ietf/templates/meeting/agenda.txt b/ietf/templates/meeting/agenda.txt
index e9deba2191..7143624eaf 100644
--- a/ietf/templates/meeting/agenda.txt
+++ b/ietf/templates/meeting/agenda.txt
@@ -12,11 +12,25 @@ xml:lang="en-US">
Agenda of the {{ meeting_num|ordinal }} IETF Meeti
Updated as of {{ last_update_info.updated_date }} {{ last_update_info.updated_time }} (ET)
-{{ meeting_info.start_date|date:"l"|upper }}, {{ meeting_info.start_date|date:"F j, Y" }}
-{{ nonsession_info.0.time_desc }} {{ nonsession_info.0.non_session_ref }} - {{ meetingvenue_info.reg_area_name }}
-{% for item in qs_sun %}{{ item.sched_time_id1.time_desc }} {{ item.acronym_name }} - {{ item.sched_room_id1.room_name }}
+
+{% regroup queryset_list_pre_session by day_id as pre_days %}
+{% for pre_day in pre_days %}
+ {{ pre_day.list.0.meeting_date|date:"l"|upper }}, {{
+pre_day.list.0.meeting_date|date:"F j, Y" }}
+ {% ifequal pre_day.list.0.day_id 0 %}
+ {{ nonsession_info.0.time_desc }} {{ nonsession_info.0.non_session_ref }}
+- {{ meetingvenue_info.reg_area_name }}
+
+ {% endifequal %}
+ {% for item in pre_day.list %}
+ {% for session in item.sessions %}
+ {{ item.time_desc }} {{ session.acronym_name }} - {{
+session.sched_room_id1.room_name }}
+ {% endfor %}
+ {% endfor %}
+
{% endfor %}
-
+
{% regroup object_list by day_id as days %}{% for day in days %}
{{ day.list.0.meeting_date|date:"l"|upper }}, {{ day.list.0.meeting_date|date:"F j, Y" }}
{% if day.list.0.reg_info %}{{ day.list.0.reg_info }} - {{ meetingvenue_info.reg_area_name }}