Last active
February 1, 2022 15:46
-
-
Save gcrsaldanha/4d6d47db4620b4517678ba684b883333 to your computer and use it in GitHub Desktop.
Django Rest Framework playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.django-rest-framework.org/api-guide/fields/#error_messages | |
from rest_framework import serializers as s | |
class User(s.Serializer): | |
name = s.CharField(error_messages={"blank": "This is a custom message! Yeah!"}) | |
user = User(data={"name": ""}) | |
user.is_valid() | |
print(user.errors) |
Author
gcrsaldanha
commented
Feb 1, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment