#4046 closed (fixed)
ForeignKey's formfield does not respect limit_choices_to
Reported by: | 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)
Change History (20)
by , 18 years ago
Attachment: | formfield_patch.diff added |
---|
by , 18 years ago
Attachment: | formfield_patch.2.diff added |
---|
comment:1 by , 18 years ago
This also needs to be fixed on the rest of the related fields in related.py (ManyToManyField for instance).
by , 18 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 , 18 years ago
Wondering how this will fit in with the newforms-admin branch. Is limit_choices_to on death row by any chance?
by , 17 years ago
Attachment: | related.py.patch added |
---|
Patch for ForeignKey, OneToOneField, ManyToManyField, no validation
comment:3 by , 17 years ago
Skipped the validation for reasons pointed out in http://groups.google.com/group/django-developers/browse_thread/thread/f5808692c7e1186d
comment:4 by , 17 years ago
Cc: | added |
---|
comment:6 by , 17 years ago
Triage Stage: | Unreviewed → Ready 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 , 17 years ago
Needs tests: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
(bumping status back until I come up with tests for this)
comment:8 by , 17 years ago
Summary: | ForeignKey's formfield does not respect limit_choices → ForeignKey's formfield does not respect limit_choices_to |
---|
comment:10 by , 16 years ago
Owner: | changed from | to
---|
comment:11 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:12 by , 16 years ago
milestone: | → 1.0 |
---|
comment:13 by , 16 years ago
Triage Stage: | Accepted → Fixed on a branch |
---|
I guess this is more incentive to switch to NFA.
updated patch that also changes newforms' model.py to respect the limited choices in clean()