From 95514247d86ebe0a1582d1fa7a9ffc314ac514f4 Mon Sep 17 00:00:00 2001 From: Arthur Vuillard Date: Fri, 22 May 2026 16:09:20 +0200 Subject: Fixed #37116 -- Explained why a code is useful in a ValidationError. --- docs/ref/forms/validation.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt index 5715d15fa7..4ff73cb88a 100644 --- a/docs/ref/forms/validation.txt +++ b/docs/ref/forms/validation.txt @@ -117,7 +117,8 @@ Raising ``ValidationError`` In order to make error messages flexible and easy to override, consider the following guidelines: -* Provide a descriptive error ``code`` to the constructor:: +* Provide a descriptive error ``code`` to the constructor, to allow + programmatic use (e.g. in tests) that will not vary with translations:: # Good ValidationError(_("Invalid value"), code="invalid") -- cgit v1.3