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

Fix docs typo in Serializers Validators #9563

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

cheehong1030
Copy link
Contributor

Description

Pull Request Description

Fix: Correct example for UniqueTogetherValidator in serializer documentation

The example provided for using UniqueTogetherValidator in the serializer documentation currently uses an IntegerField for the room_number field. This is incorrect, as UniqueTogetherValidator is designed to work with relational fields, not integer fields.

This pull request replaces the IntegerField with a ChoiceField for the room_number field, which is a more appropriate field type for this scenario. This change ensures that the example accurately demonstrates how to use UniqueTogetherValidator with related fields.

Changes Made:

  • In the example code snippet, the room_number field has been changed from:
    room_number = serializers.IntegerField(choices=[101, 102, 103, 201])
    to:
    room_number = serializers.ChoiceField(choices=[101, 102, 103, 201])

This minor correction will help users understand how to properly implement UniqueTogetherValidator in their serializers.

room_number = serializers.IntegerField(choices=[101, 102, 103, 201])

@auvipy auvipy merged commit 9016efe into encode:master Oct 23, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants