The version of snippet that works with Django 1.5. Kudos to kmike for the original snippet.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# serializers/json_pretty.py"""Add the line to settings.py:: SERIALIZATION_MODULES = {'json-pretty': 'serializers.json_pretty'}And call dumpdata as follows:: ./manage.py dumpdata --format=json-pretty <app_name>"""fromdjango.core.serializers.jsonimportSerializerasJSONSerializerclassSerializer(JSONSerializer):defstart_serialization(self):super(Serializer,self).start_serialization()self.json_kwargs['ensure_ascii']=False
Comments
Please login first before commenting.