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?
Thanks
Radovan
--
View this message in context: http://www.nabble.com/choices-tp18246312p18246312.html
Sent from the django-users mailing list archive at Nabble.com.
--
View this message in context: http://www.nabble.com/choices-tp18246312p18249595.html
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
--
View this message in context: http://www.nabble.com/choices-tp18246312p18254242.html
You can do:
CHOICES1 = (
('1', 'Red'),
('2', 'Green'),
('3', 'Blue'),
('5', 'Brown'),
)
CHOICES2 = (
('0', 'Basic Colors'),
('4', 'Other Colors'),
)
and pass what you want to the model.
If you want the user to select only C1 you can do choices = CHOICES1
and if you want to select all the set you can do choices = CHOICES1 + CHOICES2
--
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net
SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928
Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
guess i'll have to find other way to that, not in Model level.
but thanks
--
View this message in context: http://www.nabble.com/choices-tp18246312p18259026.html