У меня есть следующая структура моделей в 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...}
Пожалуйста, помогите мне здесь .....