I am confused as to how you expect the serializer to behave with respect to pending fields ... Perhaps I missed something ...
doc for json serialization says:
Keep in mind that if you serialize the use of this module directly, not all Django output can be passed unchanged to simplejson. In particular, lazy translation objects need a special encoder written for them.
Doc talks about lazy translations, but I think any lazy operation applies.
I think that what you see is just the right conclusion, if you have not written some special encoder that takes care of getting (accessing) the correct value of the pending fields.
Edit after your comment:. I missed the fact that no other fields are encoded. What are the types of other fields? Can we see your model? FK and M2M fields are handled differently with the default encoder - but I don't see anything on django.core.serializers.python.Serializer or django.core.serializers.json.Serializer , which explains why other non-deferred fields are not encoded ...
Edit after some further research: OBJModel_deferred_create_dt in your json payload above made me dig a little further. This seems to be the result of calling django.db.models.queryutils.deferred_class_factory() from the __reduce__ method in the base class of the django model. deferred_class_factory() :
Returns an object of the class, which is a copy of the "model", with the specified "attrs", replaced by DeferredAttribute objects. "Pk_value" associates pending attributes with a specific model instance.
Everything becomes muddy here (for me!): In fact, etching is done against the proxy model for your actual OBJModel . This proxy model should return, when given, the non-deferred fields of the original model. But in your case this is not so.
I will try to set up a little test and see if I can replicate the problem.
source share