Django group by foreign key id -
how can group query qualifications
, group them quote__uuid
? looked aggregation doesn't seem fit need.
my ideal output [{'quote_uuid_1':[qualification_1, qualification_2], 'quote_uuid_2':[qualification_3] }]
class quote uuid = models.charfield() class qualification quote = models.foreignkey(quote)
try:
result = [{quote.id:quote.qualification_set.all()} quote in quote.objects.all()]
Comments
Post a Comment