我有两个模型:问题和调查
class Question(models.Model):
text = models.TextField()
category = models.CharField(max_length=20, choices=(('personal', 'Personal'), ('team', 'Team'), ('company', 'Company')))
low_answer = models.CharField(max_length = 200, null=True)
high_answer = models.CharField(max_length = 200, null=True)
class Survey(models.Model):
description = models.CharField(max_length = 200, null=True)
date = models.DateTimeField(auto_now_add=True)
category = models.CharField(max_length=20, choices=(('personal', 'Personal'), ('team', 'Team'), ('company', 'Company')))
questions = models.ManyToManyField(Question)
所以,Survey 有一个作为 ManytoMany 的字段问题,我现在想知道如何在 Survey 上制作一个表格来收集每个问题的答案?每个问题我只需要一个 int 值。我不想自己构建表单,我更愿意为此使用 django。
想法?