tags:

views:

27

answers:

2

I have complex models and would like to just 'dump' some querysets to see exactly what they contain from view code.

I tried the generic list_detail (from urls.py) - but it appears to require writing a template.

Is there a way to dump data from a view (like how json is saved) that will work with anything passed?

+1  A: 

You could serialize the queryset to XML and then return that in the response. Something like:

from django.core import serializers

def view(request):
    xml = serializers.serialize('xml', FooModel.objects.all())
    response = HttpResponse(xml, mimetype='application/xml')
    return response
ars
Thanks ars for the direction.
Scott Treseder
A: 

Have you looked into the built-in databrowse app?

Daniel Roseman