mirror of
https://github.com/django/django.git
synced 2025-06-27 14:29:19 +00:00
[2.2.x] Fixed #30600 -- Clarified that ValueError raised by converter.to_python() means no match.
Backport of f197c3dd9130b18397022605c27ffe5755f329d7 from master
This commit is contained in:
parent
7d52d056e3
commit
0ea952e3d6
@ -146,7 +146,9 @@ A converter is a class that includes the following:
|
|||||||
|
|
||||||
* A ``to_python(self, value)`` method, which handles converting the matched
|
* A ``to_python(self, value)`` method, which handles converting the matched
|
||||||
string into the type that should be passed to the view function. It should
|
string into the type that should be passed to the view function. It should
|
||||||
raise ``ValueError`` if it can't convert the given value.
|
raise ``ValueError`` if it can't convert the given value. A ``ValueError`` is
|
||||||
|
interpreted as no match and as a consequence a 404 response is sent to the
|
||||||
|
user.
|
||||||
|
|
||||||
* A ``to_url(self, value)`` method, which handles converting the Python type
|
* A ``to_url(self, value)`` method, which handles converting the Python type
|
||||||
into a string to be used in the URL.
|
into a string to be used in the URL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user