Skip to content

Make serializers.ValidationError compatible with Django ValidationError #8077

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

Closed
dgasparri opened this issue Jul 10, 2021 · 3 comments
Closed

Comments

@dgasparri
Copy link

Django Rest Framework ValidationError in rest_framework.exceptions has the following constructor:

def __init__(self, detail=None, code=None)

Django original ValidationError in django.core.exceptions has the following constructor:

def __init__(self, message, code=None, params=None)

The difference is subtle and obscure, especially for a beginner that read the Django documentation on how to properly write a ValidationError exception https://docs.djangoproject.com/en/3.2/ref/forms/validation/#raising-validationerror
. I spent an hour trying to figure out why Django "proper way" of writing a validation exception was not working for me

antonchasnyk added a commit to antonchasnyk/django-rest-framework that referenced this issue Aug 10, 2021
antonchasnyk added a commit to antonchasnyk/django-rest-framework that referenced this issue Aug 11, 2021
antonchasnyk added a commit to antonchasnyk/django-rest-framework that referenced this issue Aug 11, 2021
@stale
Copy link

stale bot commented Apr 28, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@auvipy
Copy link
Member

auvipy commented Feb 6, 2023

@Ehsan200 should we close this? or you have something more to work on this issue?

@Ehsan200
Copy link
Contributor

Ehsan200 commented Feb 6, 2023

@auvipy i think we're good; we can close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants