[Answer]-Purpose of "code" kwarg in ValidationError constructor

1👍

In the Source Code, it says that it is because Python2 had a message attribute, so they can’t duck type on it, so they used code instead for compatibility. Here’s the Source Code link:

https://docs.djangoproject.com/en/dev/_modules/django/core/exceptions/#ValidationError

Leave a comment