を照会:多くの分野に多くの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を選択すると2つのchoicefields(BodySubPartとBodyPart)を持つランタイムフォームを作成したいと思います。 Ex。
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...}
ここで私を助けてください.....あなたは試してみました何