Answers for "get data from model with field name in django"

0

get data from model with field name in django

field_name = "is_staff"
user = User.objects.get(pk=0)
field_name_val = getattr(user, field_name)
Posted by: Guest on January-07-2021

Code answers related to "get data from model with field name in django"

Python Answers by Framework

Browse Popular Code Answers by Language