【发布时间】:2012-02-07 18:07:38
【问题描述】:
我在 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...}
请帮帮我.....
【问题讨论】:
标签: django django-models django-forms django-views