def create_ical(request, slug):
event = get_object_or_404(Event, slug=slug)<EOL>start = event.start_date<EOL>start = datetime.datetime(start.year, start.month, start.day)<EOL>if event.end_date:<EOL><INDENT>end = event.end_date<EOL>end = datetime.datetime(end.year, end.month, end.day)<EOL><DEDENT>else:<EOL><INDENT>end = start<EOL><DEDENT>cal = card_me.iCalendar()<EOL>cal.add('<STR_LIT>').value = '<STR_LIT>'<EOL>vevent = cal.add('<STR_LIT>')<EOL>vevent.add('<STR_LIT>').value = start<EOL>vevent.add('<STR_LIT>').value = end<EOL>vevent.add('<STR_LIT>').value = datetime.datetime.now()<EOL>vevent.add('<STR_LIT>').value = event.name<EOL>response = HttpResponse(cal.serialize(), content_type='<STR_LIT>')<EOL>response['<STR_LIT>'] = '<STR_LIT>'<EOL>response['<STR_LIT>'] = '<STR_LIT>'<EOL>return response<EOL>
Creates an ical .ics file for an event using python-card-me.