Skip to content
Browse files

Merge branch 'dev'

  • Loading branch information...
2 parents 07c808e + 2ccc246 commit e30daa6f68eecc99492528290b304b7e9e4c68a0 @brosner brosner committed Mar 7, 2011
View
27 pycon_project/apps/schedule/views.py
@@ -470,18 +470,25 @@ def schedule_user_bookmarks(request, user_id, user_hash):
bookmarks = UserBookmark.objects.filter(user=user)
cal = Calendar()
- cal.add("prodid", "-//PyCon 2011 Bookmarks//us.pycon.org//")
+ cal.add("prodid", "-//PyCon 2011 Bookmarks//us.pycon.org//EN")
+ cal.add("version", "2.0")
+ cal.add("method", "REQUEST")
+ cal.add("calscale", "GREGORIAN")
+ cal.add("X-WR-CALNAME", "PyCon 2011 Bookmarks - %s" % user.username)
+ cal.add("X-WR-TIMEZONE","US/Eastern")
for bookmark in bookmarks:
- presentation = bookmark.presentation
- event = Event()
- event.add("summary", presentation.title)
- event.add("dtstart", presentation.slot.start)
- event.add("dtend", presentation.slot.end)
- event.add("dtstamp", datetime.datetime.utcnow())
- event.add("description", presentation.description)
- event["uid"] = presentation.pk
- cal.add_component(event)
+ p = bookmark.presentation
+ if p.slot is not None:
+ event = Event()
+ event.add("summary", p.title)
+ event.add("dtstart", p.slot.start)
+ event.add("dtend", p.slot.end)
+ event.add("dtstamp", datetime.datetime.utcnow())
+ event.add("description", p.speaker.name + "\n\n" + p.description)
+ event.add("location", p.slot.track)
+ event["uid"] = str(p.pk) + "-2011.us.pycon.org"
+ cal.add_component(event)
response = HttpResponse(cal.as_string(), content_type="text/calendar")
response["Content-Disposition"] = "filename=pycon2011-%s-bookmarks.ics" % user.username.encode("utf-8")
View
2 pycon_project/requirements/project.txt
@@ -26,4 +26,4 @@ django-fixture-generator==0.2.0
nashvegas==0.5
redis==2.2.2
sorl-thumbnail==3.2.5
-icalendar==2.1
+icalendar==1.2
View
2 pycon_project/templates/schedule/conference.html
@@ -118,7 +118,7 @@
{% if user.is_authenticated %}
<div>Click <img src="{{ STATIC_URL }}img/star.png" /> to bookmark</div>
- <!-- <div>Your bookmarks: <a href="{% url schedule_user_bookmarks request.user.id user_hash %}">.ics</a> -->
+ <div>Download your bookmarks ( <a href="{% url schedule_user_bookmarks request.user.id user_hash %}">iCalendar</a> )</div>
{% else %}
<div><a href="{% url acct_login %}?next={{ request.path }}">Log in</a> to be able to bookmark talks and panels that interest you</div>
{% endif %}

0 comments on commit e30daa6

Please sign in to comment.
Something went wrong with that request. Please try again.