#32013: TypeError: Field 'id' expected a number but got
<django.forms.models.ModelChoiceIteratorValue object at 0xdeadbeef>
---------------------------+--------------------------------------
     Reporter:  Jaap Roes  |                    Owner:  nobody
         Type:  Bug        |                   Status:  closed
    Component:  Forms      |                  Version:  3.1
     Severity:  Normal     |               Resolution:  invalid
     Keywords:             |             Triage Stage:  Unreviewed
    Has patch:  0          |      Needs documentation:  0
  Needs tests:  0          |  Patch needs improvement:  0
Easy pickings:  0          |                    UI/UX:  0
---------------------------+--------------------------------------
Changes (by felixxm):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Yes is a documented (see
 [https://docs.djangoproject.com/en/3.1/ref/forms/fields/#iterating-
 relationship-choices "Iterating relationship choices"] and
 
[https://docs.djangoproject.com/en/3.1/ref/forms/fields/#django.forms.ModelChoiceIterator.__iter__
 ModelChoiceIterator.__iter__()]) and intended change (see #30998), it also
 simplifies your code. I guess we could add a short note in the "Backwards
 incompatible" section. Would you like to prepare a clarification? If not I
 can add sth.

 > I'm not sure if this is fixable. Maybe it's possible to somehow proxy to
 the value attribute when evaluating a ModelChoiceIteratorValue in the the
 context of a database lookup?

 Yes, you can use `k.value`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32013#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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.b61359a96334a5101f69018db88c2b1a%40djangoproject.com.

Reply via email to