我需要在 Django 中开发一个 UNION 查询,其中包含 3 个模型,即 WebQuery、WebReply 和 BusinessOwners,输出应为以下形式。
{
"(#conversation_id#)_(#b_id#)": {
"from": "(#user_id)",
"email": "(#user_email)",
"date_time": "#get from db",
"query": "are you open ?",
"from_r_id": "(#representative_id)",
"from_r_name": "(#rep_name)",
"business_registered": "FALSE"
"to_business_name": "CCD saket",
"chat": [{
"direction": 1,
"text": "yes sir",
"date_time": "424 577"
}, {
"direction": 0,
"text": "ok",
"date_time": "424 577"
}]
},
当只涉及一个模型时,我知道如何查询,但不确定联合查询。这将如何实现?