我的模特
class Project(models.Model):
name = models.CharField(max_length=255, unique=True)
info = models.CharField(max_length=255, unique=True)
m2mStatus = models.ManyToManyField("ProjectStatus")
class ProjectStatus(models.Model):
status = models.BooleanField(default=False)
startTime = models.DateTimeField(auto_now=True)
description = models.CharField(max_length=255)
我想这样注释:
pj = Project.objects.filter(name="abc")
ps = pj.m2mStatus.last()
Project.objects.filter(name="abc").annotate(status=ps.status)
任何帮助?