OK, so my expectations were unreasonable. (Too bad because it would seem to be a very user friendly and elegant way of limiting choices in forms.) So, what do you suggest as the reasonable method to limit choices on a form_from_instance or form_from_model? Maybe I misunderstood the part of the documentation that discourages one from using the information on this page and encourages one to use the newforms documentation:
http://www.djangoproject.com/documentation/forms/ The thing is that in the newforms documentation no way of accomplishing what I am after is given. On Nov 2, 10:54 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On 11/2/07, rm <[EMAIL PROTECTED]> wrote:[snip] > > > However, even that is not intuitive since one would assume that since > > the form is reading the field definition from the model it would know > > to use any filters specified there. So, I think this is a design flaw > > in the current implementation, in my little insignificant opinion. I > > think all forms should, by default, honor any filter used in the model > > definition. I guess a way of overriding that could be provided, if > > there are *exceptional* cases that require something different. > > Doesn't this make sense? > > Except limit_choices_to is specifically documented to "limit the available > admin choices", not choices for any forms built from the model. If there is > a design flaw, in my opinion it is that this admin-specific option is so > tightly coupled to the model definition, leading to expectations like > yours. One of the goals for newforms-admin is to remove this kind of tight > coupling, though it doesn't appear it has been done for limit_choices_to > (yet?). There is an open ticket (#3096) to fix some limit_choices_to > behavior, which has been moved to newforms-admin, but the attached > newforms-admin patch doesn't appear to have done anything to move > limit_choices_to out of the model. Perhaps it will be done before the > ticket is actually fixed. > > Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---