def run(self, **kwargs): if kwargs.get('ics'): ics = kwargs.get('ics') ics_str = create_ics(ics.user) response = HttpResponse(ics_str) response['Content-Type'] = 'text/calendar' response['Content-Disposition'] = 'attachment; filename="ics-%s.ics"' % (ics.user.pk) return response