Django查询与最新的关系

时间:2013-10-14 15:19:51

标签: python django

我有以下型号:

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

0 个答案:

没有答案