Answer the question
In order to leave comments, you need to log in
How to give a Csv file while changing the name?
There is a file, let's say itog.csv in the upload folder. How to give the file to the user while changing the name to itof_final.csv?
You need to give in views
Answer the question
In order to leave comments, you need to log in
def get(self, request, *args, **kwargs):
dataset = self.resource_class.export(queryset=self.get_queryset()) # тут поменяй логику получения csv файла на свою
response = StreamingHttpResponse(dataset, content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="export.csv"' # export.csv меняй на то имя какое тебе необходимо
return response
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question