I am using session in my Django Application.
request.session['permissions']
is structured in the following manner. The key is same for every values. Basically it is a list of dictionaries
[{'mykey': 'value1'}, {'mykey': 'value2'}, {'mykey': 'value3'},
{'mykey': 'value4'}, {'mykey': 'value5'}, {'mykey': 'value6'}]
permissions = request.session['permissions']
Now I want to check if value4
is present inside permissions
. I am not getting how to check the value.
Whenever I am trying to access value like this
permissions.mykey
It is giving me error
'list' object has no attribute 'mykey'
I want to do similar like this
permissions = request.session['permissions']
if value not in permissions:
print('Value is inside list')