#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
               Reporter:  Jon Dufresne          |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Forms                 |        Version:  master
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
 I frequently use `fields_for_model()` to generate form fields dynamically
 on a model form. The form may have different fields based on the request,
 system settings,  or other input. Using `fields_for_model()` is very
 convenient to build these dynamic fields. For the most part, it is built
 consistently had the field originally been defined on `Meta.fields`.

 One shortfall I noticed, `limit_choices_to` is not applied to form field
 querysets the way it typically is for `ModelForm`s. To make the
 `fields_for_model()` function more convenient and consistent with fields
 generated by `ModelForm`, I'd like to suggest moving the "Apply
 limit_choices_to" code from `BaseModelForm` to `fields_for_model()`.

 Currently here:

 Suggested location:

Ticket URL: <https://code.djangoproject.com/ticket/27563>
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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to