Add ical download/subscription for important dates for meetings,
similar to the existing meeting view - Legacy-Id: 18419
This commit is contained in:
parent
ca057911ea
commit
9df0994827
|
@ -585,6 +585,16 @@ class MeetingTests(TestCase):
|
|||
post_date = meeting.importantdate_set.get(name=idn).date
|
||||
self.assertEqual(pre_date, post_date+datetime.timedelta(days=1))
|
||||
|
||||
def test_important_dates_ical(self):
|
||||
meeting = MeetingFactory(type_id='ietf')
|
||||
meeting.show_important_dates = True
|
||||
meeting.save()
|
||||
populate_important_dates(meeting)
|
||||
url = urlreverse('ietf.meeting.views.important_dates', kwargs={'num': meeting.number, 'output_format': 'ics'})
|
||||
r = self.client.get(url)
|
||||
for d in meeting.importantdate_set.all():
|
||||
self.assertContains(r, d.date.isoformat())
|
||||
|
||||
def test_group_ical(self):
|
||||
meeting = make_meeting_test_data()
|
||||
s1 = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
|
||||
|
|
|
@ -104,7 +104,7 @@ type_ietf_only_patterns_id_optional = [
|
|||
url(r'^proceedings/overview/$', views.proceedings_overview),
|
||||
url(r'^proceedings/progress-report/$', views.proceedings_progress_report),
|
||||
url(r'^important-dates/$', views.important_dates),
|
||||
|
||||
url(r'^important-dates.(?P<output_format>ics)$', views.important_dates),
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
@ -3582,7 +3582,7 @@ def api_upload_bluesheet(request):
|
|||
return HttpResponse("Done", status=200, content_type='text/plain')
|
||||
|
||||
|
||||
def important_dates(request, num=None):
|
||||
def important_dates(request, num=None, output_format=None):
|
||||
assert num is None or num.isdigit()
|
||||
preview_roles = ['Area Director', 'Secretariat', 'IETF Chair', 'IAD', ]
|
||||
|
||||
|
@ -3602,8 +3602,24 @@ def important_dates(request, num=None):
|
|||
or (user and user.is_authenticated and has_role(user, preview_roles))):
|
||||
meetings.append(future_meeting)
|
||||
|
||||
context={'meetings':meetings}
|
||||
return render(request, 'meeting/important-dates.html', context)
|
||||
if output_format == 'ics':
|
||||
for m in meetings:
|
||||
m.cached_updated = m.updated()
|
||||
m.important_dates = m.importantdate_set.prefetch_related("name")
|
||||
for d in m.important_dates:
|
||||
d.midnight_cutoff = "UTC 23:59" in d.name.name
|
||||
|
||||
ics = render_to_string('meeting/important_dates.ics', {
|
||||
'meetings': meetings,
|
||||
}, request=request)
|
||||
# icalendar response file should have '\r\n' line endings per RFC5545
|
||||
response = HttpResponse(re.sub("\r(?!\n)|(?<!\r)\n", "\r\n", ics), content_type='text/calendar')
|
||||
response['Content-Disposition'] = 'attachment; filename="important-dates.ics"'
|
||||
return response
|
||||
|
||||
return render(request, 'meeting/important-dates.html', {
|
||||
'meetings': meetings
|
||||
})
|
||||
|
||||
TimeSlotTypeForm = modelform_factory(TimeSlot, fields=('type',))
|
||||
|
||||
|
|
|
@ -4,13 +4,18 @@
|
|||
|
||||
{% load ietf_filters static %}
|
||||
|
||||
{% block title %}IETF {{meetings.0.number}} : Important Dates{% endblock %}
|
||||
{% block title %}IETF {{meetings.0.number}}: Important Dates{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% origin %}
|
||||
<h2>Important Dates</h2>
|
||||
<h1>Important Dates</h1>
|
||||
|
||||
<p>iCalendar: <a href="webcal://{{request.get_host}}{% url 'ietf.meeting.views.important_dates' output_format='ics' %}">webcal subscription</a>
|
||||
· <a href="{% url 'ietf.meeting.views.important_dates' output_format='ics' %}">download</a>
|
||||
</p>
|
||||
|
||||
{% for meeting in meetings %}
|
||||
<h3>IETF {{meeting.number}} : {{ meeting.date}}, {{meeting.city}}, {{meeting.country}}</h3>
|
||||
<h3>IETF {{meeting.number}}: {{ meeting.date}}, {{meeting.city}}, {{meeting.country}}</h3>
|
||||
<ul>
|
||||
{% with first=forloop.first %}
|
||||
{% for d in meeting.importantdate_set.all %}
|
||||
|
|
26
ietf/templates/meeting/important_dates.ics
Normal file
26
ietf/templates/meeting/important_dates.ics
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% load humanize %}{% autoescape off %}{% load ietf_filters %}BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
METHOD:PUBLISH
|
||||
PRODID:-//IETF//datatracker.ietf.org ical importantdates//EN
|
||||
{% for meeting in meetings %}{% for d in meeting.important_dates %}BEGIN:VEVENT
|
||||
UID:ietf-{{ meeting.number }}-{{ d.name_id }}-{{ d.date.isoformat }}
|
||||
SUMMARY:IETF {{ meeting.number }}: {{ d.name.name }}
|
||||
CLASS:PUBLIC
|
||||
DTSTART{% if not d.midnight_cutoff %};VALUE=DATE{% endif %}:{{ d.date|date:"Ymd" }}{% if d.midnight_cutoff %}235900Z{% endif %}
|
||||
DTSTAMP:{{ meeting.cached_updated|date:"Ymd" }}T{{ meeting.cached_updated|date:"His" }}Z
|
||||
DESCRIPTION:{{ d.name.desc }} {% if first and d.name.slug == 'openreg' or first and d.name.slug == 'earlybird' %}
|
||||
Register here: https://www.ietf.org/how/meetings/register/{% endif %}{% if d.name.slug == 'opensched' %}
|
||||
To request a Working Group session, use the IETF Meeting Session Request Tool:
|
||||
{{ request.scheme }}://{{ request.get_host}}{% url 'ietf.secr.sreq.views.main' %}
|
||||
If you are working on a BoF request, it is highly recommended to tell the IESG
|
||||
now by sending an email to iesg@ietf.org to get advance help with the request.{% endif %}{% if d.name.slug == 'cutoffwgreq' %}
|
||||
To request a Working Group session, use the IETF Meeting Session Request Tool:
|
||||
{{ request.scheme }}://{{ request.get_host }}{% url 'ietf.secr.sreq.views.main' %}{% endif %}{% if d.name.slug == 'cutoffbofreq' %}
|
||||
To request a BOF, please see instructions on Requesting a BOF:
|
||||
https://www.ietf.org/how/bofs/bof-procedures/{% endif %}{% if d.name.slug == 'idcutoff' %}
|
||||
Upload using the ID Submission Tool:
|
||||
{{ request.scheme }}://{{ request.get_host }}{% url 'ietf.submit.views.upload_submission' %}{% endif %}{% if d.name.slug == 'draftwgagenda' or d.name.slug == 'revwgagenda' or d.name.slug == 'procsub' or d.name.slug == 'revslug' %}
|
||||
Upload using the Meeting Materials Management Tool:
|
||||
{{ request.scheme }}://{{ request.get_host }}{% url 'ietf.meeting.views.materials' num=meeting.number %}{% endif %}
|
||||
END:VEVENT
|
||||
{% endfor %}{% endfor %}END:VCALENDAR{% endautoescape %}
|
Loading…
Reference in a new issue