Django

Code

Ticket #4046 (new)

Opened 1 year ago

Last modified 2 weeks ago

ForeignKey's formfield does not respect limit_choices_to

Reported by: webograph <webograph@eml.cc> Assigned to: nobody
Component: django.newforms Version: SVN
Keywords: Cc: django@versea.be
Triage Stage: Accepted Has patch: 1
Needs documentation: 0 Needs tests: 1
Patch needs improvement: 0

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

formfield_patch.diff (1.0 kB) - added by webograph <webograph@eml.cc> on 04/14/07 14:12:18.
formfield_patch.2.diff (1.6 kB) - added by webograph <webograph@eml.cc> on 04/14/07 14:41:45.
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@eml.cc> on 05/18/07 14:44:53.
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@gmail.com> on 08/19/07 07:24:45.
Patch for ForeignKey?, OneToOneField?, ManyToManyField?, no validation
4046.diff (1.7 kB) - added by ubernostrum on 12/16/07 00:58:46.
Patch for current trunk
4046.qsrf.diff (1.3 kB) - added by programmerq on 04/30/08 19:23:32.
for svn trunk after qs-rf merge

Change History

04/14/07 14:12:18 changed by webograph <webograph@eml.cc>

  • attachment formfield_patch.diff added.

04/14/07 14:41:45 changed by webograph <webograph@eml.cc>

  • attachment formfield_patch.2.diff added.

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

05/16/07 22:39:19 changed by Paul Lanier <planier@google.com>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

05/18/07 14:44:53 changed by webograph <webograph@eml.cc>

  • 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.

05/24/07 23:36:43 changed by simon@slicmedia.com

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

08/19/07 07:24:45 changed by Jan Rademaker <j.rademaker@gmail.com>

  • attachment related.py.patch added.

Patch for ForeignKey?, OneToOneField?, ManyToManyField?, no validation

08/19/07 07:25:34 changed by Jan Rademaker <j.rademaker@gmail.com>

10/17/07 02:39:38 changed by anonymous

  • cc set to django@versea.be.

10/29/07 10:59:30 changed by anonymous

Will this be fixed or should I stop using it?

12/16/07 00:58:46 changed by ubernostrum

  • attachment 4046.diff added.

Patch for current trunk

12/16/07 00:59:21 changed by ubernostrum

  • stage changed from Unreviewed to 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.

12/16/07 01:16:17 changed by ubernostrum

  • needs_tests set to 1.
  • stage changed from Ready for checkin to Accepted.

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

01/17/08 03:51:44 changed by Daniel Pope <dan@mauveinternet.co.uk>

  • summary changed from ForeignKey's formfield does not respect limit_choices to ForeignKey's formfield does not respect limit_choices_to.

04/30/08 19:22:53 changed by programmerq

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

04/30/08 19:23:32 changed by programmerq

  • attachment 4046.qsrf.diff added.

for svn trunk after qs-rf merge


Add/Change #4046 (ForeignKey's formfield does not respect limit_choices_to)




Change Properties
Action