Comment (by jorgecarleitao):
I think this was fixed when docs for custom fields were added, see
https://docs.djangoproject.com/en/1.6/howto/custom-model-fields/#the-
subfieldbase-metaclass and https://docs.djangoproject.com/en/1.6/howto
/custom-model-fields/#django.db.models.Field.to_python
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by timo):
@jorgecarleitao, did you read the comments on this ticket? The report is
describing issues with those docs you linked -- there hasn't been anything
added since this report as far as I've seen.
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:9>
Comment (by anubhav9042):
With better documentation in
[https://github.com/django/django/commit/e1fa7dffdc1b141cb858160890d448ca778366e4
e1fa7df], I think now the various usage of `to_python` is clear now.
IMO we can close this now.
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:10>
* cc: anubhav9042@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:11>
Comment (by timo):
Have you read the comments above and taken time to understand the nuances
(I haven't)? For example, in comment 4 it says: "I will make a quote from
the docs as an example: [quote] This is not true." I am not sure if the
report is correct or not, but that paragraph remains unaltered even after
the commit you mentioned.
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:12>
Comment (by anubhav9042):
Replying to [comment:12 timo]:
Yes I have gone though the docs and understood the situation.
Earlier the entire docs for `to_python` was in custom_field docs but now
it is not. It has been moved to appropriate place where it mentions its
usual purpose of `Converts a value as returned by the database (or a
serializer) to a Python object.` and also mentions `See converting-
database-values-to-python-objects for usage.`, see
[https://github.com/django/django/commit/e1fa7dffdc1b141cb858160890d448ca778366e4
#diff-7e6909c7694e8a3ae170c2a22f9b6e0cR1618 here], where it mentions about
its extra purpose of being used with `SubFieldBase` and this same is said
in the docs for `SubFieldBase`.
I know that lines haven't been changed, but I felt that this way of
representation cleared everything. Whatever the doubt was, it was about
the two different usages of `to_python` which is surely mentioned under
proper headings now, so I don't think anything else is required.
At max, we can change the link `See converting-database-values-to-python-
objects for usage.` to `See converting-database-values-to-python-objects
for various usages.` and line `If your custom field needs the to_python
method to be called when it is created, you should be using The
SubfieldBase metaclass mentioned earlier.` to `If your custom field needs
the to_python method to be called everytime it is created along with its
usual usage, you should be using The SubfieldBase metaclass mentioned
earlier.`
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:13>
Comment (by anubhav9042):
What do you suggest?
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:14>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"b6aa60f4252311ef8ef24b4ffd99984197be7ee6"]:
{{{
#!CommitTicketReference repository=""
revision="b6aa60f4252311ef8ef24b4ffd99984197be7ee6"
Fixed #14638 -- Clarified model Field.to_python() docs.
Thanks Anubhav Joshi for the patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:15>
Comment (by Tim Graham <timograham@…>):
In [changeset:"d818e02134ae719108e12b24a7da7416328c2190"]:
{{{
#!CommitTicketReference repository=""
revision="d818e02134ae719108e12b24a7da7416328c2190"
[1.7.x] Fixed #14638 -- Clarified model Field.to_python() docs.
Thanks Anubhav Joshi for the patch.
Backport of b6aa60f425 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:16>
Comment (by Tim Graham <timograham@…>):
In [changeset:"955fdc8cdb0c1a98741687513980b64de8f20c75"]:
{{{
#!CommitTicketReference repository=""
revision="955fdc8cdb0c1a98741687513980b64de8f20c75"
[1.6.x] Fixed #14638 -- Clarified model Field.to_python() docs.
Thanks Anubhav Joshi for the patch.
Backport of b6aa60f425 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/14638#comment:17>