#6399 closed (duplicate)
ModelForm fields for RelatedFields should use limit_choices_to
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The limit_choices_to property for ForeignKey, ManyToManyField etc currently only affects the admin page for the model. It does not currently limit choices for the ModelChoiceField/MultipleModelChoiceField when using ModelForm.
I find this slightly misleading to read, and inconvenient to use, as I would like to use limit_choices_to to place a constraint on the data across the board, not just in the admin screen.
Change History (3)
comment:1 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 17 years ago
Component: | Database wrapper → django.newforms |
---|
Note:
See TracTickets
for help on using tickets.
Duplicate of #4096. The reason why this is the case is due to a bug in newforms where
limit_choices_to
is not respected by the ForeignKey formfield method. The admin works because it is currently using oldforms.