Re: Variable choices in ModelChoiceField

2007-08-17 Thread John Dohn
On 8/18/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > > On 8/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > But how do I pass the 'user' object to the Form so I can use it in > > filter() or run .groups.all() on it? > > I do it this way: > > self.fields['emails'].queryset = > BIZEmail.

Re: Variable choices in ModelChoiceField

2007-08-17 Thread Peter Melvyn
On 8/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > But how do I pass the 'user' object to the Form so I can use it in > filter() or run .groups.all() on it? I do it this way: self.fields['emails'].queryset = BIZEmail.objects.filter(owner=oa_request.user.id) self.fields['emails'].widget.

Variable choices in ModelChoiceField

2007-08-17 Thread [EMAIL PROTECTED]
Hi all, I have a newform GroupSelectionForm with: group_id = forms.ModelChoiceField(Group.objects.all()) where users are supposed to choose their primary group. However I only want to offer them groups in which they have membership. I.e. instead of Group.objects.all() do something like Group