I would like to create my choice fields in my models according to a
hierarchy of conditions, but I can't think of how to specify this in
Python.

For example...pseudo code...

class mod1(models.Model):

    choice1 = (
      ('a', 'A'),
      ('b', 'B'),
    )

    choice_a_if_choice1_is_A = (
       ('z', 'Z'),
       ('y', 'Y'),
    )

    choice_a_if_choice1_is_B = (
        ('m', 'M')
        ('n', 'N')
    )

    field1 = models.CharField(max_length=30, choices=choice1)

    field2 = models.CharField(max_length=30,
choices=choice_a_if_choice_is_A)
    field2 = models.CharField(max_length=30,
choices=choice_a_if_choice_is_B)

    How to I set the choices for field2 depending upon the choice
selected in field1??

)

Kind regards, Marc

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to