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

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


django python

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

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 &...

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

Main Pros and Cons of Django As A Web Framework for Python Developers

India's best Institute for Django Online Training Course & Certification. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Python Project - Create a Calorie Calculator in Django

Calorie Calculator Python Django Project - Develop a web application to track the calorie intake and take care of your health. This interesting python project help to record and estimate no of calories we need to consume

Hire Python Developers

Are you looking for experienced, reliable, and qualified Python developers? If yes, you have reached the right place. At **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")**, our full-stack Python development services...