def export(self, queryset=None, *args, **kwargs):
self.before_export(queryset, *args, **kwargs)<EOL>if queryset is None:<EOL><INDENT>queryset = self.get_queryset()<EOL><DEDENT>headers = self.get_export_headers()<EOL>data = tablib.Dataset(headers=headers)<EOL>if isinstance(queryset, QuerySet):<EOL><INDENT>iterable = queryset.iterator()<EOL><DEDENT>else:<EOL><INDENT>iterable = queryset<EOL><DEDENT>for obj in iterable:<EOL><INDENT>data.append(self.export_resource(obj))<EOL><DEDENT>self.after_export(queryset, data, *args, **kwargs)<EOL>return data<EOL>
Exports a resource.