I have added the dictionary to the object with this:
dict['var1'] = {'value': 'tetsing'}
object.dict = dict
Now I am confused how to access the dictionary in view. Do I use:
object.dict['var1']['value'] or object.dict.var1.value
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First of all you should to rename variable and attribute names so that they aren’t in conflict with built-in names like
dict.Now, in normal Python code, use the first way.
However, if you are trying to access it from the Django template, use the second one.