#23335: Related fields pointing to custom fields that store different values in
the
database than the python representation do not remember selections
---------------------------+--------------------------------------
Reporter: thenewguy | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.7-rc-2
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------
Comment (by thenewguy):
Sorry for the delayed response. I didn't get a notice of activity for
some reason.
I am not sure exactly where the bug is. This is from memory from awhile
ago, but when the form is rendered the widget is passed the raw value of
the relation (e.g. -200 instead of 1 for the int field in my demo). So
when the choice widget compares the value -200 against possible choice
values, it doesn't match because it is comparing the db value against the
to_python value. The choices iterable that the widget checks for the
value -200 in contains the to_python value that -200 was mapped to (i.e.
1).
I do not think the bug is in my code. It seems to work for everything
except for this issue with forms.
Have I explained the problem well enough for you to reproduce/observe the
symptoms?
--
Ticket URL: <https://code.djangoproject.com/ticket/23335#comment:2>
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/067.5f904555c34ec6abfbafc4490d48d3a8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.