Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing the read_only fields in the serializer in the post /swagger template in (ForignKeyFields) #877

Open
SamiTalebian opened this issue Dec 3, 2023 · 0 comments

Comments

@SamiTalebian
Copy link

class MatchSerializer(serializers.ModelSerializer):
winner = AthleteWinnerSerializer(read_only=True)
class Meta:
model = Match
fields = ['uid', 'round_one', 'round_two', 'round_three', 'winner']

In this example the winner is generated in the body of the post api like the example below :

{
"round_one": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"round_two": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"round_three": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"winner": {
"username": "string"
}
}

@SamiTalebian SamiTalebian changed the title Sho=owing the read_only fields in the serializer in the post /swagger template Showing the read_only fields in the serializer in the post /swagger template Dec 3, 2023
@SamiTalebian SamiTalebian changed the title Showing the read_only fields in the serializer in the post /swagger template Showing the read_only fields in the serializer in the post /swagger template in (ForignKeyFields) Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant