On 10/26/06, Ice9 <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm kinda new to django, and I ran into a problem
> I'm making a cutom form, and one of the field I want it to be
> SelectField. the problem is I dont want to hard code the choices in, I
> want to generate a set of choice I can use from the data i already
> have.
> For example, I have a lot of polls, and I want the choices to be all
> the polls posted by user root. How would I come to do that?

Sounds like you need 'limit_choices_to' on a Foreign Key. Add a
Foreign Key on Choices to the Poll model; use the limit_choices_to
argument on the ForeignKey defintion to filter out those choices you
don't want.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to