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 there is an error in the form the choices won't
> show up when it renders again). To get around this wrap the function
> call in  a list so it is forced to be evaluated, i.e choices =
> list(my_function())..

I have the same problem as the OP. In my example, choices needs to be
a list of things associated with the current user, so I need to have
the request.user so that I can retrieve an appropriate queryset of
objects.

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
http://www.bentbacktulips.co.uk/


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to