[Django] #37116: The doc mentions that a code in a validationerror is good but does not tell why

25 views
Skip to first unread message

Django

unread,
May 22, 2026, 10:17:41 AMMay 22
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
---------------------------------+-----------------------------------------
Reporter: Arthur Vuillard | Type: Uncategorized
Status: new | Component: Documentation
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/37116>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 22, 2026, 3:38:09 PMMay 22
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
--------------------------------------+------------------------------------
Reporter: Arthur Vuillard | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
* type: Uncategorized => Cleanup/optimization
* version: 6.0 => dev

Comment:

Sure, that sounds good. My advice would be to weave it into the original
text, like

{{{#!diff
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index 5715d15fa7..31f74350f9 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 allow programmatic use that
will not
+ vary with translations::

# Good
ValidationError(_("Invalid value"), code="invalid")
}}}

I'll reopen your pull request.
--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:1>

Django

unread,
May 22, 2026, 4:03:33 PMMay 22
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
-------------------------------------+-------------------------------------
Reporter: Arthur Vuillard | Owner: Arthur
Type: | Vuillard
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Arthur Vuillard):

* owner: (none) => Arthur Vuillard
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:2>

Django

unread,
May 22, 2026, 4:03:50 PMMay 22
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
-------------------------------------+-------------------------------------
Reporter: Arthur Vuillard | Owner: Arthur
Type: | Vuillard
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Arthur Vuillard):

[https://github.com/django/django/pull/21346 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:3>

Django

unread,
May 26, 2026, 11:52:06 AMMay 26
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
-------------------------------------+-------------------------------------
Reporter: Arthur Vuillard | Owner: Arthur
Type: | Vuillard
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:4>

Django

unread,
May 26, 2026, 11:52:34 AMMay 26
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
-------------------------------------+-------------------------------------
Reporter: Arthur Vuillard | Owner: Arthur
Type: | Vuillard
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"95514247d86ebe0a1582d1fa7a9ffc314ac514f4" 9551424]:
{{{#!CommitTicketReference repository=""
revision="95514247d86ebe0a1582d1fa7a9ffc314ac514f4"
Fixed #37116 -- Explained why a code is useful in a ValidationError.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:5>

Django

unread,
May 26, 2026, 11:53:04 AMMay 26
to django-...@googlegroups.com
#37116: The doc mentions that a code in a validationerror is good but does not tell
why
-------------------------------------+-------------------------------------
Reporter: Arthur Vuillard | Owner: Arthur
Type: | Vuillard
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"f6f7aa011753bd009073b5b3de7453a4f250f221" f6f7aa0]:
{{{#!CommitTicketReference repository=""
revision="f6f7aa011753bd009073b5b3de7453a4f250f221"
[6.1.x] Fixed #37116 -- Explained why a code is useful in a
ValidationError.

Backport of 95514247d86ebe0a1582d1fa7a9ffc314ac514f4 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37116#comment:6>
Reply all
Reply to author
Forward
0 new messages