# annotate
class User(models.Model): status = models.SmallIntegerField(verbose_name="status", default=1) jifen = models.IntegerField(verbose_name="积分", default=0)
# 计算 jifen 总量 zongjife = User.objects.filter(status=3).annotate(zongjifen=Sum('jifen'))[0]['zongjifen']
标签:status,段值,zongjifen,verbose,models,jifen,annotate,Django From: https://www.cnblogs.com/chaoqi/p/16745768.html