这是我的模型
class Student:
user = ForeignKey(User)
department = IntegerField()
semester = IntegerField()
...
class Attendance:
student = ForeignKey(Student)
subject = ForeignKey(Subject)
month = IntegerField()
year = IntergerField()
present = IntegerField()
total = IntegerField()
students = Student.objects.filter(semester=semester)
如果学生存在,我如何在模型之间执行正确的连接Student
,Attendance
以便我可以获得包含所有students
和出勤率的查询集,否则为空?
文档提到了左连接,但没有提到右连接。