DB表的Django使查詢
select * from AAA;
id | Name | Class | Grade |
--------------------------------------
1 | john | 1 | A |
2 | Jane | 2 | B |
3 | Joon | 2 | A |
4 | Josh | 3 | C |
|
代碼
Django
search_result = AAA.objects.filter(Grade = 'B').count()
print search_result
search_result - > 2
我想按值等級改變上課。
Django
target_filter = 'Class'
search_result = AAA.objects.filter(__"target_filter..."__ = '3').count()
search_result - > 1
Q)我怎樣才能完成這個代碼?可能嗎?