Django组由外键id

时间:2015-10-31 01:07:40

标签: django

如何对查询Qualifications进行分组并按quote__uuid对其进行分组?我调查aggregation,但似乎不符合我的需要。

我的理想输出是[{'quote_uuid_1':[qualification_1, qualification_2], 'quote_uuid_2':[qualification_3] }]

class Quote
   uuid = models.CharField()

class Qualification
   quote = models.ForeignKey(Quote)

1 个答案:

答案 0 :(得分:1)

尝试:

Sub CellFormula()
Dim Cell As Variant
For Each Cell In Selection
  Cell.Formula = "=$B$1*" & Cell.Value
Next
End Sub