How can i create a xml file in django where the file is to contain objects from a queryset?
def my_serialize(request):
from django.core import serializers
data = serializers.serialize('xml', Student.objects.filter(Q(name__startswith='A')),
fields=('name','dob'))
from django.core.files import File
f = open('content.xml', 'w')
myfile = File(f)
myfile.write(data)
myfile.close()
After i call the above function, my content file remains empty, there is no data that gets written in it.