The only two places that mention this method are the
[https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.Field.from_db_value
Model field reference] and the
[https://docs.djangoproject.com/en/3.0/howto/custom-model-fields
/#converting-values-to-python-objects "Writing custom model fields"
guide], but neither mention what `expression` is or how it should be used.
In fact, there is no specification for `value` or `connection` either, but
at least the meaning of these parameters can be inferred.
See also: https://stackoverflow.com/q/60560775/6117426
--
Ticket URL: <https://code.djangoproject.com/ticket/31368>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Django uses backend and field/expression converters. `expression` is a
field or an expression and it's used by backend converters. All converters
have the same signature that's why we keep the `expression` parameter in
`Field.from_db_value()` and `Expression.convert_value()` signatures even
if for them it's the same as `self`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:1>
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:2>
* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:3>
Comment (by Hasan Ramezani):
I've created a [https://github.com/django/django/pull/12582 PR].
Just added @felixxm [https://code.djangoproject.com/ticket/31368#comment:1
comment] to documentation.
Please let me know if there is something to be improved.
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:4>
* easy: 0 => 1
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"6929f13254ce42b0a4ee5d677591d47b61023ae7" 6929f132]:
{{{
#!CommitTicketReference repository=""
revision="6929f13254ce42b0a4ee5d677591d47b61023ae7"
Fixed #31368 -- Doc'd 'expression' parameter of
Field.from_db_value()/Expression.convert_value().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"aea93441399176128a6d7e67bf65aa0533b3026f" aea93441]:
{{{
#!CommitTicketReference repository=""
revision="aea93441399176128a6d7e67bf65aa0533b3026f"
[3.0.x] Fixed #31368 -- Doc'd 'expression' parameter of
Field.from_db_value()/Expression.convert_value().
Backport of 6929f13254ce42b0a4ee5d677591d47b61023ae7 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31368#comment:7>