#31295: required ModelChoiceField makes duplicate (cursor) queries to the database -------------------------------------+------------------------------------- Reporter: Aurélien Pardon | Owner: nobody Type: | Status: closed Cleanup/optimization | Component: Forms | Version: 2.2 Severity: Normal | Resolution: wontfix Keywords: Model | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Carlton Gibson):
* status: new => closed * resolution: => wontfix Comment: Hi Aurélien, Using the iterator was a deliberate design choice. (Placing your suggestion in causes tests failure, including `test_choices_freshness` in line with this.) The use to point to in `Select.use_required_attribute()` shouldn't be problematic, since [https://github.com/django/django/blob/271fdab8b78af558238df51c64b4d1c8dd0792bb/django/forms/widgets.py#L555-L560 `self.choices` is fully evaluated in `ChoiceWidget.__init__()`], as per the comment there, precisely to allow repeated iteration. I think the underlying issue here is probably #22841. -- Ticket URL: <https://code.djangoproject.com/ticket/31295#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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.918d11cf56e01872b9f9a5efb6db1829%40djangoproject.com.