On Tue, 2007-11-20 at 00:19 -0800, Nader wrote: > Hallo, > > I have a model in which I have to use a input-field with choices > option. > > ACCESS = ( > ('RO', 'readonly'), > ('WO', 'writeonly'), > ('RW', 'readwrite'), > ) > > Class myClass (...) > .. > ... > active = models.IntegerField(choices=ACCESS, radio_admin=True) > ... > > The value for 'choices' is of tuple type, actually tuple of tuple. In > some case I have to use some dynamic information, it means that I > don't know in front how many element in tuple will be present. I can > define a empty tuple and then assign the elements to the tuple, but > tuple is a unmutuable type. I can't use also 'list' or dictionary. > Would you like to help me to solve this problem.
If you mean that every single time you access the field the choices might be different, then you don't want to be using 'choices' here. You want a many-to-many field instead. If you mean that you won't know the value of choices until the *first* time you access the field, read this: http://www.pointy-stick.com/blog/2007/03/26/django-tips-variable-choice-lists/ Regards, Malcolm -- He who laughs last thinks slowest. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---