1、ManyToOne
例如有两个类之间是many-to-one的关系(question and answer)
(1)访问:
从answer访问question非常容易,而从question访问answer则需要:
question.answer_set.all()
(2)添加:
给question添加answer可以使用:
one_of_the_questions.answer_set.add(new_answer)
one_of_the_questions.answer_set.create(------)
如此做是可以不需要再使用save()的方法
(3)删除:
q.answer_set.remove(a)
q.answer_set.clear()