this is realted to my other question
django-rest-framework, multitable model inheritance, ModelSerializers and nested serializers
In django rest framework we can define nested model serializer like so
class OtherModelSerializer(serializer.ModelSerializer):
mybasemodel_set = MyBaseModelSerializer(many=True)
class Meta:
model = OtherModel
when we create an OtherModelSerializer, the MyBaseModelSerializer is instantiated before __init__
is run.
I believe this is the case because if I override the __init__()
of MyBaseModelSerializer and check "instance", it is None.
My question is when and how does MyBaseModelSerializer
get passed the queryset or instance for mybasemodel_set
?
My goal here is to override what happens when we do this.