python - django admin actions export to csv separate response -


these tables:

a) header

b) rows

are managed admin, a) model i've added action rows referenced in b), works fine when applied 1 object in a). selecting multiple objects in a) turns out in single csv file. how can split multiple response multiple csv, 1 file each object inside rows referred it?

import csv django.utils.encoding import smart_str  def export_su_csv(modeladmin, request, queryset):  u in queryset:   # process each selected row separate responses     response = httpresponse(content_type='text/csv')     a=rows.objects.filter(ref=u)          response['content-disposition'] = u'attachment; filename={}'.format(u)        writer = csv.writer(response)             o in a:             # single row in rows         writer.writerow([             smart_str(o.field1),             smart_str(o.field2),             smart_str(o.field3),         ])  return response 

would possible return multiple response? if yes how? i've tried write list of response , return that, result s empty.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -