Re: how to set the choices of Select Widget by code in the newforms

2007-02-11 Thread Cathy Young
On Feb 10, 11:42 pm, "gordyt" <[EMAIL PROTECTED]> wrote: > > I don't think there's any way of accessing the request.user from the > > Form class (is there?). If I could pass in the choices when I'm > > instantiating the form from views.py my problem would be solved. Is > > this possible? > > Cathy

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread gordyt
> I don't think there's any way of accessing the request.user from the > Form class (is there?). If I could pass in the choices when I'm > instantiating the form from views.py my problem would be solved. Is > this possible? Cathy this is absolutely possible. Here is an example from one of my pro

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread Cathy Young
On Feb 10, 5:33 pm, "canen" <[EMAIL PROTECTED]> wrote: > If I understand what you are asking, choices can be set to a function, > as long as it returns the correct format. If you return a generator I > think there is a bug that will only call it the first time the form > is rendered (e.g. if ther

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread daev
On Feb 10, 8:07 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > how? In my project i have that code: #in some view form_class = AddPostForm #form adds post to the blog form_class.base_fields[ 'category' ].choices = getCategoriesTuple( request.blog ) #sets choices to ChoiceField --~--~-

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread canen
If I understand what you are asking, choices can be set to a function, as long as it returns the correct format. If you return a generator I think there is a bug that will only call it the first time the form is rendered (e.g. if there is an error in the form the choices won't show up when it ren

how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread [EMAIL PROTECTED]
how? --~--~-~--~~~---~--~~ 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