#28316: ModelChoiceField to_field_name doesn't work if it's different from the
model field's to_field
--------------------------------+------------------------------------------
     Reporter:  László Károlyi  |                    Owner:  László Károlyi
         Type:  Bug             |                   Status:  assigned
    Component:  Forms           |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  1               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  1
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------------

Comment (by László Károlyi):

 So the generic idea of the fix is to also fix the

 > ModelForm ForeignKey data is initialized on ModelForms at __init__ time,
 and then, only the PKs are put into the self.initial dict.

 part. After that, the value that will be passed to
 `ModelChoiceField.prepare_value()`. My opinion is still that this part is
 too complicated and should be rewritten at a later stage.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28316#comment:10>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ea127d0fdc5ecb7360ac76d7df50cde3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to