def export_data(request, atype):
if atype == "sheet":
return excel.make_response_from_a_table(
Customer, 'xls', file_name="sheet")
elif atype == "custom":
query_sets = Customer.objects.all()
column_names = ['first_name', 'last_name', 'email', 'birthday']
return excel.make_response_from_query_sets(
query_sets,
column_names,
'xls',
file_name="custom"
)
else:
return HttpResponseBadRequest(
"Bad request. please put one of these " +
"in your url suffix: sheet, book or custom")
评论列表
文章目录