Finally I got my code working by using an __init__ method in my class
form to populate my ChoiceField fields as described in this post:

http://groups.google.com/group/django-users/browse_thread/thread/98bde0a6d818e627

I also tried Malcolm's suggestion:

http://www.pointy-stick.com/blog/2007/03/26/django-tips-variable-choice-lists/

but it didn't work for me. In his example he uses a list that is
extended based on a settings variable but when I tried it with a list
of tuples coming from a model it didn't refresh the choices.

The third option was passing a function to choices, instead of a call
to the function, according to James' book this should make the
function to be executed each time the class is instantiated but I was
getting 'object not iterable', even when I used 'yield' instead of
return in my get_choices function.

Anyway, the __init__ approach works for me :)

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