我有以下型号:
class Folder(models.Model):
name = models.CharField()
class Project(models.Model):
name = models.CharField()
folder = models.ForeignKey(Folder)
class Percentage(models.Model):
name = models.CharField()
project = models.ForeignKey(Project)
created = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User)
仅限folder.id
如何为percentage
附带的每个project
获取最新 folder
,然后找到平均百分比folder
?