ValidationError pass multi level dictionary insted of single dict

Is there a way to raise a ValidationError with nested dict of errors?. For example:

raise ValidationError({
                "index_errors": {"index1": {
                    "test_con": "Error text example",
                    "test_con2": "Error text example2"
                }}
            }

I am getting 'ValidationError' object has no attribute 'error_list'

You should put error info in lists, something like

raise ValidationError({"index_error": {"index1": {"test_con": ["Error text"]}}}
Back to Top