두 모델 선택 필드가있는 모델이있는 경우 두 번째 필드의 선택 세트를 첫 번째로 선택한 것에 종속되게하는 방법이 있습니다. 예를 들어, 다음 코드가 주어지면 사용자는 "회사"필드에 대해 APPLE을 선택합니다. 사용자가 자신의 "부서"필드 선택 항목에 대해서만 APPLE DIV_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)
....
저는 본질적으로 똑같은 말을 할 때 하나의 대답이나 다른 대답을 받아들이는 방법을 잘 모릅니다. 둘 다 고마워. – kjarsenal