Dynamic ModelChoiceField

2007-05-31 Thread sorrison
I am using a ModelChoiceField (default_project) in a form and want the initial queyset to change when the form is created. I've tried doing it like this: forms.py -- class UserAccountForm(forms.Form): . default_project = forms.ModelChoiceField(queryset=Project.objects.all(), requir

Re: Dynamic ModelChoiceField

2007-06-01 Thread Dwarf
On Jun 1, 3:27 am, sorrison <[EMAIL PROTECTED]> wrote: > I am using a ModelChoiceField (default_project) in a form and want the > initial queyset to change when the form is created. > > I've tried doing it like this: > > forms.py -- > class UserAccountForm(forms.Form): >. >defaul

dynamic ModelChoiceField and handling form submission

2009-02-10 Thread wynfred
I'm sure there is a simple solution here, but I've been searching the forum archive and elsewhere but so far haven't found an answer. I have a form that uses some dynamic ModelChoiceField fields, filtering the model for the logged-in user. The form in app's forms.py, slight

Re: dynamic ModelChoiceField and handling form submission

2009-02-10 Thread Alex Gaynor
On Tue, Feb 10, 2009 at 3:24 PM, wynfred wrote: > > I'm sure there is a simple solution here, but I've been searching the > forum archive and elsewhere but so far haven't found an answer. > > I have a form that uses some dynamic ModelChoiceField fields, > filt

Re: dynamic ModelChoiceField and handling form submission

2009-02-10 Thread wynfred
> The issue is you are passing the kwarg "user" after the arg.  Since user is > the first param when you pass request.POST as the first arg it assumes it is > user.  Reorganize your arguments in some(make user first, or pass > request.POST as a kwarg) way. > > Alex Thanks, Alex. That was a huge h