Im trying to avoid a hardcoding situation in my code
if have a Customer queryset for example the columns are (name,phone,email….)
so if I do
customer = Customer.objects.get(name = 'bbc')
# to get the values of each field I need to do
customer.name
customer.phone
customer.email
……
to avoid having to do this as I need to compare each field in an If statement to make a not of any changes from a form I made a list that contains the column name
Example of the if statement
if customer.name == some variable or customer.email == some vairiable …..
I made a list that contains the column name to avoid this issue
list = ['name', 'phone' , 'email']
when I do this
for loop
if customer.list[i] == some variable
I get an error customer doesn't contain attribute list
how can I get around this issue
thanks in advance