def post(self, *args, **kwargs): if not self.exporter: messages.error(self.request, _('The selected exporter was not found.')) return redirect('control:event.orders.export', kwargs={ 'event': self.request.event.slug, 'organizer': self.request.event.organizer.slug }) if not self.exporter.form.is_valid(): messages.error( self.request, _('There was a problem processing your input. See below for error details.' )) return self.get(*args, **kwargs) cf = CachedFile() cf.date = now() cf.expires = now() + timedelta(days=3) cf.save() export.apply_async(args=(self.request.event.id, str(cf.id), self.exporter.identifier, self.exporter.form.cleaned_data)) return redirect( reverse('cachedfile.download', kwargs={'id': str(cf.id)}))
def post(self, *args, **kwargs): if not self.exporter: messages.error(self.request, _('The selected exporter was not found.')) return redirect('control:event.orders.export', kwargs={ 'event': self.request.event.slug, 'organizer': self.request.event.organizer.slug }) if not self.exporter.form.is_valid(): messages.error(self.request, _('There was a problem processing your input. See below for error details.')) return self.get(*args, **kwargs) cf = CachedFile() cf.date = now() cf.expires = now() + timedelta(days=3) cf.save() export.apply_async(args=(self.request.event.id, str(cf.id), self.exporter.identifier, self.exporter.form.cleaned_data)) return redirect(reverse('cachedfile.download', kwargs={'id': str(cf.id)}))
def do_export(self, cf, instance, data): return export.apply_async(args=(self.request.event.id, str(cf.id), instance.identifier, data))