OK, I think I finally got it. (Thanks to Python's introspection and interactive shell!) Here is how I got it to work in my view:
def away_edit(request, away_id): aw = get_object_or_404(away, id=away_id) aw_form = forms.form_for_instance(aw) filtered_choices = Contact.objects.filter(is_staff=True) aw_form.base_fields['contact'].widget = forms.widgets.Select(choices=[(obj.id, obj.__str__()) for obj in filtered_choices]) Tada!!! Any one wants to add it to the documentation or some FAQ wicky? :) On Nov 2, 12:08 pm, rm <[EMAIL PROTECTED]> wrote: > > Actually I don't think your expectations were unreasonable, I think they > > were natural given the unfortunately tight coupling between this admin > > option and model definition, plus the fact that the option has nothing in > > its name to indicate it is admin-specific. > > Well, I still think that instead of decoupling the admin option from > the model, they should leave it as is and implement support for it on > all forms. It is beautiful and very Pythonic. > > > As for how to do it in general, sorry I can't help there (though I got the > > impression you had found a way to do it?). My own app has no need of forms, > > so it is an area I know very little about. > > Well, I thought I had found a way to do it, but I can't get it to > work, as I described already. > > > I don't think you misunderstood the documentation either. Building stuff > > with oldforms is discouraged, since they are going away. But newfoms is > > still work-in-progress, so doc is not complete and some things may not be > > entirely worked out. Such is the way with volunteer projects. > > Interesting dilemma. I just find it hard to believe that nobody else > has found a way to work around this issue. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---