mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Update converters to take a consistent set of parameters.
As suggested by Anssi. This has the slightly strange side effect of passing the expression to Expression.convert_value has the expression passed back to it, but it allows more complex patterns of expressions.
This commit is contained in:
@@ -477,7 +477,7 @@ instances::
|
||||
class HandField(models.Field):
|
||||
# ...
|
||||
|
||||
def from_db_value(self, value, connection, context):
|
||||
def from_db_value(self, value, expression, connection, context):
|
||||
if value is None:
|
||||
return value
|
||||
return parse_hand(value)
|
||||
|
||||
@@ -412,7 +412,7 @@ calling the appropriate methods on the wrapped expression.
|
||||
clone.expression = self.expression.relabeled_clone(change_map)
|
||||
return clone
|
||||
|
||||
.. method:: convert_value(self, value, connection, context)
|
||||
.. method:: convert_value(self, value, expression, connection, context)
|
||||
|
||||
A hook allowing the expression to coerce ``value`` into a more
|
||||
appropriate type.
|
||||
|
||||
@@ -1630,7 +1630,7 @@ Field API reference
|
||||
|
||||
When loading data, :meth:`from_db_value` is used:
|
||||
|
||||
.. method:: from_db_value(value, connection, context)
|
||||
.. method:: from_db_value(value, expression, connection, context)
|
||||
|
||||
.. versionadded:: 1.8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user