我有以下結構在Django:Django-多對多現場查詢的型號
class BodySubPart(models.Model):
body_subpart=models.CharField(max_length=20)
def __str__(self):
return self.body_subpart
class BodyPart(models.Model):
body_part=models.CharField(max_length=20)
body_subpart=models.ManyToManyField(BodySubPart)
def __str__(self):
return self.body_part
例:
example,
if BodyPart=head then BodySubPart= face,mouth,eyes,nose.
if BodyPart=arm then BodySubPart= shoulder,fingers,elbow.
很多這樣的身體部位被存儲。 ... 現在我想創建一個運行時窗體有兩個選擇域(BodySubPart和BodyPart),這樣當我選擇BodyPart時,它應該更改BodySubPart中的列表。例如,
The first choicefield has body parts={head,arm,chest...}
The second choice field should change when i select a particular part
If i select "head" then second choice field should show,
body sub parts={face,mouth,eyes,nose...}
請幫我在這裏.....