Creating iCal feeds in Django

I also wanted to add an iCal feed to my Django website. I did it like this.

In my view, I set up the mime type thusly:
response = HttpResponse(mimetype='text/calendar')

I figured that minutes and seconds were fairly unimportant for my application, and the dates would be quite happy to be Zulu (GMT), so I dodged that part up and just hard coded it, and I’m just passing the date and time below. You should get fancy in your view if you want the times to be perfectly aligned.

Then, I set up my template:
BEGIN:VCALENDAR
VERSION:2.0
NAME:mactactic.com Replacement Calendar
X-WR-CALNAME:mactactic.com Replacement Calendar
{% for md in modeldict %}BEGIN:VEVENT
URL;VALUE=URI:http://mactactic.com/detail/{{md.slug}}/
SUMMARY:End-of-life for {{md.name}}
DTSTART:{{md.replacedate|date:"Ymd"}}T000000Z
DTEND:{{md.replacedate|date:"Ymd"}}T000000Z
END:VEVENT
{% endfor %}END:VCALENDAR