tags:

views:

13

answers:

1

[python 2.6 - django 1.1.1]

Hello.

I'm writing a custom serializer for my django application.

All the objects that I use are proxy objects derived from django model classes and implement special members that I must serialize (hence the custom serializer).

So I've begun to implement a new abstract serializer that inherits django.core.serialiazer.base.Serializer and redifines the serialize(...) method. I've also begun a python concrete serializer (child-class of my own base Serializer), needed for custom construction of the dict.

Problem is, when my queryset comes into the serialize() method, each individual obj in it has an empty list ([]) for obj._meta.local_fields. As a consequence, my serialized python dicts are almost empty (apart from primary key & model), because I rely on this list.

I can't seem to find where this field is inited. I don't understand, also, why _meta.local_fields is inconsistent when I use my serializer and not when I use django's serializer (i pass the same querysets of proxy objects).

Thanks.

EDIT: i thought maybe some __init__ code somewhere in the django packages had an effect, but I can't find anything in that direction, either.

A: 

It seems that proxy objects don't have local_fields set, which would be logical. I've just found something in the existing code (exploiting the django python serializer) that works around the lack of local_fields...

I think my question is void :-/

Olivier H