django - How to choose specific columns when using depth in serializer -
I have a model that consists of two Try using the nested serializer documentation Example: Edit: Similar reply creator of Django Relief Framework It also includes some related notes in which nested serializers are read-only and you may have to include a ForeignKeys I only
ForeignKeys , so I am using the
depth variable, which originally gives me all columns of tables referred to by FK. What column should a column include to select? Class SomeSerializer (serializers.ModelSerializer): Class Meta: Model = MyAwesomeModel fields = ('id', 'fk_one', 'fk_two') Depth = 1
source argument on the serializer field.
Comments
Post a Comment