#32912: Using label_from_instance on ModelChoiceField requires resetting 
queryset
first
------------------------+--------------------------------------
     Reporter:  mbehm   |                    Owner:  nobody
         Type:  Bug     |                   Status:  closed
    Component:  Forms   |                  Version:  3.2
     Severity:  Normal  |               Resolution:  duplicate
     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 Mariusz Felisiak):

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


Comment:

 I'm sorry but I don't see anything new in your description. As far as I'm
 aware you don't need do "reset" a queryset when subclassing
 `ModelChoiceField` as documented, e.g.
 {{{
 from django.forms import ModelChoiceField

 class MyModelChoiceField(ModelChoiceField):
     def label_from_instance(self, obj):
         return "My Object #%i" % obj.id

 class Aform(forms.Form):
     user = MyModelChoiceField(queryset=User.objects.all())

 }}}
 Duplicate of #6839.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32912#comment:1>
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.84b907486486598aef37e99945a71088%40djangoproject.com.

Reply via email to