我是通过 django_ical 提供一个 icalender 文件的服务器。问题是文件名为download.ics。我正在尝试将其更改为 MyCalender.ics。如果找到这个旧片段。我更喜欢使用 django_ical,因为它可以很好地与 django 联合。
cal = vobject.iCalendar()
cal.add('method').value = 'PUBLISH' # IE/Outlook needs this
for event in event_list:
vevent = cal.add('vevent')
icalstream = cal.serialize()
response = HttpResponse(icalstream, mimetype='text/calendar')
response['Filename'] = 'filename.ics' # IE needs this
response['Content-Disposition'] = 'attachment; filename=filename.ics'