我是新来的小马。
假设我有这两个类和它们之间的多对多关系:
class Student(db.Entity):
id = PrimaryKey(str)
name = Required(str)
courses = Set("Course")
class Course(db.Entity):
id = PrimaryKey(str)
name = Required(str)
semester = Required(int)
students = Set(Student)
我想选择一些特定学生学习的课程。我要做的是:
student = Student.select(lambda s: s.id == id).get()
courses = Course.select(lambda c: c.students == student).get()
我得到这个错误:
Incomparable types 'Set of Student' and 'Student' in expression: c.students == student
这样做的正确方法是什么?谢谢