0
我有一個小Django應用程序,當我用django orm查詢我的數據庫時,我得到我的對象列表。 我想要的是查詢匹配的db列的名稱。 可能嗎?從orm查詢檢索到的對象獲取字段名稱
在此先感謝!
results = Verbs.objects.filter(
Q(fps__icontains = " " + word_name + " ") | Q(fps__endswith = " " + word_name) | Q(fps__startswith = word_name + " ") |
Q(sps__icontains = " " + word_name + " ") | Q(sps__endswith = " " + word_name) | Q(sps__startswith = word_name + " ") |
Q(tps__icontains = " " + word_name + " ") | Q(tps__endswith = " " + word_name) | Q(tps__startswith = word_name + " ") |
Q(fpp__icontains = " " + word_name + " ") | Q(fpp__endswith = " " + word_name) | Q(fpp__startswith = word_name + " ") |
Q(spp__icontains = " " + word_name + " ") | Q(spp__endswith = " " + word_name) | Q(spp__startswith = word_name + " ") |
Q(tpp__icontains = " " + word_name + " ") | Q(tpp__endswith = " " + word_name) | Q(tpp__startswith = word_name + " ")
).all()
我想在這裏爲匹配查詢字段的名稱。例如:fps或FPP ...
您能否展示您的查詢以及您想從中獲取哪種結果? – nickzam