Skip to content

Instantly share code, notes, and snippets.

View toti1212's full-sized avatar
🪐

Rodrigo Suárez toti1212

🪐
View GitHub Profile
@niuware
niuware / django_stream_queryset_to_csv.md
Created October 18, 2019 03:41
How to stream a CSV file from a large QuerySet using Django's StreamingHttpResponse

Stream a CSV file from a QuerySet using StreamingHttpResponse

This is a sample on how to stream the results of a large QuerySet into a CSV file using Django StreamingHttpResponse class.

  1. Add the CSVStream class in your project, for example a writers.py file:
import csv
from django.http import StreamingHttpResponse
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@kavimaluskam
kavimaluskam / ItemTypes.js
Created January 24, 2018 07:33
React-DND & Material-ui-next: List Item
export default {
LIST_ITEM: 'listItem',
};