Dictionaries inside Lists - Django

Dictionaries inside Lists - Django

I am using session in my Django Application.

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


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')

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Python Django Tutorial | Django Course

🔥Intellipaat Django course: https://intellipaat.com/python-django-training/ 👉This Python Django tutorial will help you learn what is django web development &...

Developing Restful APIs with Python, Django and Django Rest Framework

This article is a definitive guide for starters who want to develop projects with RESTful APIs using Python, Django and Django Rest Framework.