On Wed, 2008-07-02 at 13:40 -0700, urukay wrote:
> 
> is there a way how to create choices in Models in specific way, that some
> choices are not selectable (they only group and describe choices below)?
> 
> e.g.:
> 
> CHOICES = (
>      ('0', 'Basic Colors'),
>      ('1', 'Red'),
>      ('2', 'Green'),
>      ('3', 'Blue'),
>      ('4', 'Other Colors'),
>      ('5', 'Brown'),
>         .....
> )
> 
> and I want "Basic Colors" and "Other Colors" not selectable when displaying
> CHOICES in model. Is it possible?

Just pass in the choices you want to the "choices" attribute of the
model field. Nothing requires you to have all your choices only in a
single list. And, if later, you wish to combined your various sublists
into one list for some reason, then just concatenate the individual
lists.

Don't over-think this: you want to pass in a particular small list to a
model field, so just create that list and pass it in. No complex
technology required.

Malcolm



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