Last active
January 27, 2018 14:08
-
-
Save bencleary/52b72a1e7da2fabb689226855ebab689 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Csv(View): | |
| def get(self, request): | |
| sales = Sales.objects.all() | |
| headers = [(h.column) for h in Sales._meta.get_fields()] | |
| csv_array = Generate(request).csv_file(headers=headers, data=sales) | |
| return HttpResponse(f'{csv_array[0]}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment