code: def export(self, queryset=None, *args, **kwargs):
          
  
          self.before_export(queryset, *args, **kwargs)
  
          if queryset is None:
              queryset = self.get_queryset()
          headers = self.get_export_headers()
          data = tablib.Dataset(headers=headers)
  
          if isinstance(queryset, QuerySet):
              # Iterate without the queryset cache, to avoid wasting memory when
              # exporting large datasets.
              iterable = queryset.iterator()
          else:
              iterable = queryset
          for obj in iterable:
              data.append(self.export_resource(obj))
  
          self.after_export(queryset, data, *args, **kwargs)
  
          return data
docs: Exports a resource.