How can I access the model instance from a custom Django model field's to_python
call?
When I overrode pre_save
, for example, I had model_instance
as one of the arguments.
to_python
only receives the value.
How can I do something like:
def to_python(self, value):
value = value_based_on_another_field_from_model()
return value
Thank you