Ganesh,
You'll need to create your own serializer. You can do this by
subclassing django.core.serializers.base (or perhaps you might
subclass the json one, there are a number of ways to skin the cat
here), and then registering it with
django.core.serializers.register_serializer, which is used like this:
from django.core.serializers import register_serializer, serialize
register_serializer("extra_json",
"myapp.serializer.myjsonserializer")
objs = MyModel.objects.all()
data = serialize('extra_json', objs)
Look around the django.core.serializers files at the existing
serializers for the details of how to implement your subclass.
Best of luck,
Will
On Jun 28, 2008, at 7:03 PM, M.Ganesh wrote:
>
> <me sobbing > people who asked after me got their answers, sometimes
> within 15 minutes..... I've not got any answers </me sobbing>
>
> Should I reword my query?
>
> Regards Ganesh
>
>
> -------- Original Message --------
>
> Hi All,
>
> I picked up this sample code from django documentation:
>
> from django.core import serializers
> data = serializers.serialize('xml', SomeModel.objects.all(),
> fields=('name','size'))
>
> How do I extend this to do the following:
>
> data = serializers.serialize('xml', SomeModel.objects.all(),
> fields=('name','size', '__unicode__'))
>
> Thanks in advance
>
> Regards Ganesh
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---