def export_data(self, user, query=None, filename=None):
        """
        Execute the data export task for this ``Dataset``.
        """
        task_type = ExportCSVTask

        if query:
            description = _('Export search results for "%(query)s" in %(slug)s.') \
                % {'query': query, 'slug': self.slug}
        else:
            description = _('Exporting data in %s.') % self.slug

        self.current_task = TaskStatus.objects.create(
            task_name=task_type.name,
            task_description=description,
            creator=user
        )

        self.save()

        task_type.apply_async(
            args=[self.slug],
            kwargs={ 'query': query, 'filename': filename },
            task_id=self.current_task.id
        )
dataset/ETHPy150Open pandaproject/panda/panda/models/dataset.py/Dataset.export_data/original