if I have a model that has two model choice fields, is there a way to make the choice set of the second field dependent on what is chosen in the first. Example, if given the following code, the User chooses APPLE for the “company” field — can the code be configured such that the User is presented ONLY the APPLE DIV_CHOICES for his “division” field choices?
CMP_CHOICES ('Apple', 'Apple Computers'),
('MS', 'Microsoft Inc.'),
APPLE DIV_CHOICES ( 'Desktop', 'Desktop'),
( 'iOS', 'iOS'),
( 'AS', 'AppStore'),
MS DIV_CHOICES ( 'Windows', 'Windows'),
( 'Longhorn', 'Longhorn'),
( 'Mobile', 'Mobile'),
class Contact(models.Model)
first_name = models.CharField(max_length=64, …)
last_name = models.CharField(max_length=64, …)
company = models.CharField(max_length=100, choices=CMP_CHOICES)
division = models.CharField(max_length=100, choices=DIV_CHOICES)
....
No. Choices must be all choices that are ever possible. However, you may use JavaScript on your form to limit the choices based on the first selection, but not on the model itself.