I'm new to Django and any help is appreciated, How can I restrict the choice option in one field based on a previous field. For example, if I select 'dog' for animal, I want to remove 'chocolate' from the FOOD_CHOICE, because I love dogs. Thanks!!!
ANIMAL_CHOICE = (
('a','cat'),
('b','dog'),
('c','fish'),
)
FOOD_CHOICE = (
('a', 'chocolate'),
('b', 'kittySnack'),
('c', 'steak'),
)
class Animal(models.Model):
animal = models.CharField(max_length=1, choices= ANIMAL_CHOICE)
food = models.CharField(max_length=1, choices= FOOD_CHOICE)