DB table
select * from AAA;
id | name | grade
--------------------
1 | john | A
2 | cavin | B
django
grade_list = AAA.objects.all()
for item in grade_list:
print item.name
result ->
john
cavin
============================================
I want to change this code(same function)
grade_list = AAA.objects.all()
print_field = 'name'
for item in grade_list:
print item.( print_field... )
result ->
john
cavin
Q) fill in the blank please. Is it possible?
Yes you can do this with the
getattrbuilt-in function.