Related fields pointing to custom fields that store different values in the database than the python representation do not remember selections
|Reported by:||thenewguy||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have uploaded a demonstration to github here: https://github.com/thenewguy/django_custom_primary_key_related_field_incompatibility Concisely, forms do not preserve related field selections on these custom fields.
If you have a custom field that returns a custom object from the database that is different from the value returned from to_python, related fields that point to forget the current selection when they are rendered by forms.
I encountered this attempting to use a custom field that maps signed integers to fixed length string representation of unsigned integers for use as identifiers.
Change History (8)
comment:1 Changed 2 years ago by
|Patch needs improvement:||unset|
|Status:||new → closed|
comment:3 Changed 2 years ago by
|Status:||closed → new|