Serializing Django objects
Serializing Django objects
Django’s serialization framework provides a mechanism for “translating” Django models into other formats. Usually these other formats will be text-based and used for sending Django data over a wire, but it’s possible for a serializer to handle any format (text-based or not).
See also
If you just want to get some data from your tables into a serialized form, you could use the dumpdata
management command.
Serializing data
At the highest level, serializing data is a very simple operation:
from django.core import serializers data = serializers.serialize("xml", SomeModel.objects.all