Hank -

Here's the answer you are looking for:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield

Here's an example:

stuff = forms.ModelChoiceField(queryset=Series.objects.values('whatever'),  
empty_label="     ")

Spend some serious time learning modelforms. Most of the time, they are the 
right answer.  Modelforms are different than regular forms... so you do have to 
populate the choices differently.  The key with Django is to understand when 
you need a modelform, and when you need a regular form.

modelform - Django builds forms from models.
form - You design what you want, but have to do a lot more work to populate 
the form with data.



There you go.

On Friday, January 07, 2011 02:03:39 pm hank23 wrote:
> So I can create a queryset and pass its variable in the choices
> parameter to bind a modelchoicefield from a modelform to a particular
> iterable object? So then does this work only with modelforms or with
> any kind of form (one coded manually as well)? If I can do this with
> any form then where do I code the choices parameter? The only examples
> I've seen show it being coded using dictionaries containing hard-coded
> values and being coded as part of the form in question.  Let me know
> as soon as you can. Thanks for the help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to