This file contains 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
from __future__ import unicode_literals | |
from sys import getsizeof, stderr | |
from itertools import chain | |
from collections import deque | |
try: | |
from reprlib import repr | |
except ImportError: | |
pass | |
def total_size(o, handlers={}, verbose=False): |
This file contains 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
from django.core import serializers | |
data = serializers.serialize("json", [model_instance]) | |
with open("file", mode="w") as f: | |
f.write(data) |