get data from model with field name in django

Solutions on MaxInterview for get data from model with field name in django by the best coders in the world

showing results for - "get data from model with field name in django"
Giovanni
06 Jul 2020
1field_name = "is_staff"
2user = User.objects.get(pk=0)
3field_name_val = getattr(user, field_name)