#32013: Field choice attribute returns different objects in forms.
---------------------------+--------------------------------------
     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
---------------------------+--------------------------------------

Comment (by Jaap Roes):

 Replying to [comment:5 felixxm]:

 > [...] Also, as far as I'm aware overriding `choices` for
 `forms.ModelMultipleChoiceField` and `forms.ModelChoiceField` is not a
 documented pattern I would rather override `.queryset`, see
 [https://docs.djangoproject.com/en/3.1/ref/forms/fields/#fields-which-
 handle-relationships Fields which handle relationship].

 Sure, but this pattern is commonly used and I've seen it been recommended
 on StackOverflow on several occasions. I'll investigate further and check
 if nothing breaks here. This codebase is over 10 years old and not always
 written by expert Django developers, so it's not unexpected for anti-
 patterns to show up.

 > > Or should we audit the entire codebase to see this new
 ModelChoiceIteratorValue will break stuff?
 >
 > Yes, you should always audit your code when you bump multiple releases.

 I'm only bumping a single release here. The migration from 1.4 to 3.0 has
 been completed months ago and came with it's own trials and tribulations.
 I wasn't expecting such breakage from bumping to 3.1.

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

Reply via email to