Django ORM查询
Future task started scala-execution-context-global-11
Completed some task by main
false
Completed some task by main
false
Completed some task by main
false
Future task is still pending and main thread have no more lines to execute
这会生成以下sql查询,[join used]
projects = Project.objects.filter(category__id=1111)
是否可以避免加入并得到这样的结果?
""""
select *
FROM "project"
INNER JOIN "category" ON ( "project"."category_id" = "category"."id" )
WHERE "project"."category_id" = 1111
""""
答案 0 :(得分:0)
底层db列名为category_id
(带有一个下划线);你可以直接过滤:
projects = Project.objects.filter(category_id=1111)