Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6399 closed (duplicate)

ModelForm fields for RelatedFields should use limit_choices_to

Reported by: Daniel Pope <dan@…> 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 Brian Rosner, 17 years ago

Resolution: duplicate
Status: newclosed

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.

comment:2 by Brian Rosner, 17 years ago

Component: Database wrapperdjango.newforms

Opps, I meant to reference #4046 and not #4096. ;)

comment:3 by Daniel Pope <dan@…>, 17 years ago

I didn't spot that because I searched Trac for 'limit_choices_to'.

Note: See TracTickets for help on using tickets.
Back to Top