You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
xtrm-co-in
changed the title
How to override create method so that an object of the nested serializer can be created
How to override create method in DynamicModelSerializer so that an object of the nested serializer can be created
Dec 1, 2020
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 ?
The text was updated successfully, but these errors were encountered: