I have a Transaction model having OneToMany (Foreignkey) relation with Details model. i.e. One transaction can have multiple details. I have nested Details serializer within Transaction serializer which works fine for listing and retrieving. However, I want to override create method in Transaction serializer in such a way that I can create an instance of Details object from the list provided in the request body while simultaneously creating an instance of the Transaction Object. Create method that I have overridden in drf's ModelSerializer works just fine but same isn't working with DynamicModelSerializer. Can you please guide me on how to do it ?
I have a Transaction model having OneToMany (Foreignkey) relation with Details model. i.e. One transaction can have multiple details. I have nested Details serializer within Transaction serializer which works fine for listing and retrieving. However, I want to override create method in Transaction serializer in such a way that I can create an instance of Details object from the list provided in the request body while simultaneously creating an instance of the Transaction Object. Create method that I have overridden in drf's ModelSerializer works just fine but same isn't working with DynamicModelSerializer. Can you please guide me on how to do it ?