Opened 17 years ago

Closed 16 years ago

Last modified 12 years ago

#4046 closed (fixed)

ForeignKey's formfield does not respect limit_choices_to

Reported by: webograph <webograph@…> Owned by: Luke Plant
Component: Forms Version: dev
Severity: Keywords:
Cc: django@… Triage Stage: Fixed on a branch
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ForeignKey's formfield() function, which returns the Field for a newforms.Form created by form_for_model or form_for_instance, does not filter the options by limit_choices_to.

i've attached a patch to fix that.

(i'd like to do a bit of advertising here for bug #2445 or #1891, whose target group should be roughly the same as for this bug)

Attachments (6)

formfield_patch.diff (995 bytes ) - added by webograph <webograph@…> 17 years ago.
formfield_patch.2.diff (1.6 KB ) - added by webograph <webograph@…> 17 years ago.
updated patch that also changes newforms' model.py to respect the limited choices in clean()
formfield_patch.3.diff (1.5 KB ) - added by webograph <webograph@…> 17 years ago.
svn upped to 5281 (didn't merge cleanly any more), i18n'ed exception. no changes as suggested by paul 05/16/07 yet.
related.py.patch (1.7 KB ) - added by Jan Rademaker <j.rademaker@…> 17 years ago.
Patch for ForeignKey, OneToOneField, ManyToManyField, no validation
4046.diff (1.7 KB ) - added by James Bennett 16 years ago.
Patch for current trunk
4046.qsrf.diff (1.3 KB ) - added by Jeff Anderson 16 years ago.
for svn trunk after qs-rf merge

Download all attachments as: .zip

Change History (20)

by webograph <webograph@…>, 17 years ago

Attachment: formfield_patch.diff added

by webograph <webograph@…>, 17 years ago

Attachment: formfield_patch.2.diff added

updated patch that also changes newforms' model.py to respect the limited choices in clean()

comment:1 by Paul Lanier <planier@…>, 17 years ago

This also needs to be fixed on the rest of the related fields in related.py (ManyToManyField for instance).

by webograph <webograph@…>, 17 years ago

Attachment: formfield_patch.3.diff added

svn upped to 5281 (didn't merge cleanly any more), i18n'ed exception. no changes as suggested by paul 05/16/07 yet.

comment:2 by simon@…, 17 years ago

Wondering how this will fit in with the newforms-admin branch. Is limit_choices_to on death row by any chance?

by Jan Rademaker <j.rademaker@…>, 17 years ago

Attachment: related.py.patch added

Patch for ForeignKey, OneToOneField, ManyToManyField, no validation

comment:3 by Jan Rademaker <j.rademaker@…>, 17 years ago

comment:4 by anonymous, 16 years ago

Cc: django@… added

comment:5 by anonymous, 16 years ago

Will this be fixed or should I stop using it?

by James Bennett, 16 years ago

Attachment: 4046.diff added

Patch for current trunk

comment:6 by James Bennett, 16 years ago

Triage Stage: UnreviewedReady for checkin

The most recent patch was mostly correct. I've updated it with a minor correction, so it should be good to go now.

comment:7 by James Bennett, 16 years ago

Needs tests: set
Triage Stage: Ready for checkinAccepted

(bumping status back until I come up with tests for this)

comment:8 by Daniel Pope <dan@…>, 16 years ago

Summary: ForeignKey's formfield does not respect limit_choicesForeignKey's formfield does not respect limit_choices_to

comment:9 by Jeff Anderson, 16 years ago

I've updated this to work with trunk after the qs-rf branch merge.

by Jeff Anderson, 16 years ago

Attachment: 4046.qsrf.diff added

for svn trunk after qs-rf merge

comment:10 by Luke Plant, 16 years ago

Owner: changed from nobody to Luke Plant

comment:11 by Luke Plant, 16 years ago

Resolution: fixed
Status: newclosed

(In [7733]) newforms-admin: Fixed #4046 - ForeignKey's formfield does not respect limit_choices_to. Thanks ubernostrum, programmerq

comment:12 by Jeff Anderson, 16 years ago

milestone: 1.0

comment:13 by Jeff Anderson, 16 years ago

Triage Stage: AcceptedFixed on a branch

I guess this is more incentive to switch to NFA.

comment:14 by Jacob, 12 years ago

milestone: 1.0

Milestone 1.0 deleted

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