Q is for Q - Python A to Z 0 ▲ Juha-Matti Santala 50 minutes ago · Tech · hide · 0 comments Python A-Z is a blog series about Python. Each day, I share insights, ideas and examples for different parts of Python development that match with the letter of the day. Blaugust is an annual blogging festival in August where the goal is to write a blog post every day of the month. Second Django ORM post of the week! First, an important distinction before we start: this blog post is about Django’s Q objects and not about the task queue project Django Q (or its fork Django Q2). Maybe I’ll write about them the next time I need to come up with something for letter Q because that’s not a large pool of ideas. Basics Q objects are a way to write Django queries in a more composable way. These two are equivalent in outcome: from models import Card Card.objects.filter(name='Bulbasaur') # and from django.db.models import Q bulbasaur_query = Q(name='Bulbasaur') Card.objects.filter(bulbasaur_query) For a simple example like this, there’s not a lot to gain. They are more useful for complex… No comments yet. Log in to reply on the Fediverse. Comments will appear here.