#14518: Field.to_python not called on foreign key IDs
-------------------------------------+-------------------------------------
Reporter: wolever | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by slurms):
@anubhav9042: looks like this is a problem with the way you're subclassing
the `CharField`. When `to_python` is called, it could well already be in
the right format, or it might be unset. `to_python` gets called every time
the field is assigned a value and you are responsible for ensuring it is
in the right format (https://docs.djangoproject.com/en/1.6/howto/custom-
model-fields/#django.db.models.Field.to_python). Notice the two lines at
the beginning of that example code. You will need to do something similar.
--
Ticket URL: <https://code.djangoproject.com/ticket/14518#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.4f42f8852d51b84f1afdad7e32764446%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.