15 Jul 2026
Django community aggregator: Community blog posts
Django: introducing django-orjson
Just as cars painted red are known to be faster, libraries implemented in Rust are also known to be faster. Today's example is orjson, a Rusty replacement for Python's built-in json module, boasting 10x faster serialization and 2x faster deserialization.
Such a library is great, but adopting it isn't easy, especially when your framework uses json in many different parts. To help Django developers adopt orjson, I have created django-orjson, which provides a whole bunch of drop-in replacements for Django and Django REST Framework (DRF) components backed by orjson.
For example, there's a version of JsonResponse:
from django_orjson.http import JsonResponse
def index(request):
return JsonResponse({"title": "Hello, world!"})
…a test client with matching test case classes:
from django_orjson.test import SimpleTestCase
class IndexTests(SimpleTestCase):
def test_index(self):
response = self.client.get("/", headers={"accept": "application/json"})
assert response.status_code == 200
# response.json() uses orjson to parse the response body
assert response.json() == {"title": "Hello, world!"}
…a version of Django's json_script template tag:
{% load django_orjson %}
{{ chart_data|json_script:"chart-data" }}
…and plenty more! All tested against the currently supported versions of Python and Django with 100% branch coverage.
While database queries tend to dominate the typical Django application's runtime, the time spent in serialization and deserialization can still be significant. That can make adopting orjson a nearly free performance win, which I hope django-orjson makes almost trivial for you.
Django proposal
After seeing the initial version of django-orjson, Paolo Melchiorre decided to push for adding orjson support to Django itself, in the new feature proposal Pluggable JSON serialization/deserialization backend. He made a thorough list of all the places in Django that could use orjson, and the proposal has gathered 14 thumbs-ups at the time of writing.
If you're interested in the topic of speeding up Django's JSON handling, check out the proposal and add your thoughts to the discussion.
15 Jul 2026 4:00am GMT
14 Jul 2026
Django community aggregator: Community blog posts
How to use a list/tuple/array in Django with a raw SQL cursor
This does not work:
from django.db import connection
list_of_values = [1, 2, 3]
with connection.cursor() as cursor:
cursor.execute("""
SELECT *
FROM my_model_table
WHERE some_value IN %s
""", [
tuple(list_of_values),
])
results = cursor.fetchall()
It will give you:
django.db.utils.ProgrammingError: syntax error at or near "'(1,2,3)'" LINE 4: WHERE id IN '(1,2,3)'
It used to work with psycopg v2. Now, in psycopg v3, you have to use the ANY operator. See "You cannot use IN %s with a tuple"
This will work:
from django.db import connection
list_of_values = [1, 2, 3]
with connection.cursor() as cursor:
cursor.execute(
"""
SELECT *
FROM my_model_table
WHERE some_value = ANY(%s)
""",
[
list_of_values,
],
)
results = cursor.fetchall()
Note the ANY(%s), and instead of a list that has a tuple, it's a list that has a list.
What About a List of Strings
Consider...
from django.db import connection
-list_of_values = [1, 2, 3]
+list_of_values = ['foo', 'bar', 'fiz']
with connection.cursor() as cursor:
cursor.execute(
"""
SELECT *
FROM my_model_table
WHERE some_value = ANY(%s)
""",
[
list_of_values,
],
)
results = cursor.fetchall()
That will result in:
django.db.utils.DataError: invalid input syntax for type integer: "foo"
LINE 4: WHERE some_value = ANY('{foo,bar,fiz}')
My solution was to rewrite the SQL string itself and treat each value as a parameter each. In other words, the SQL string, before being sent to cursor.execute(...) will contain something like this:
AND (
some_value = % OR
some_value = % OR
some_value = % OR
some_value = % OR
-- ...etc...
some_value = %
)
This will work and is safe:
from django.db import connection
list_of_values = ["foo", "bar", "fiz"]
with connection.cursor() as cursor:
cursor.execute(
f"""
SELECT *
FROM my_model_table
WHERE ({" OR ".join(["some_value = %s" for _ in list_of_values])})
""",
list_of_values,
)
results = cursor.fetchall()
14 Jul 2026 6:14pm GMT
10 Jul 2026
Django community aggregator: Community blog posts
Issue 345: Django security releases issued: 6.0.7 and 5.2.16
News
Django security releases issued: 6.0.7 and 5.2.16
Three new CEVs have been addressed in the latest security releases. We encourage all users of Django to upgrade as soon as possible.
Django on the Med: Venue and Hotel Details for Edition 2!
A few more confirmed details for Django on the Med 🏖️ 2026, which will take place from September 23 to 25, 2026 in Pescara, Italy 🇮🇹.
Thank you Lacey - Django Commons
Django Commons credits Lacey Henschel for helping shape the admin team from day one, including onboarding Django REST Framework, building the recruitment pipeline, and creating project check-ins that prevent stagnation. Her decision to step down is framed as proof that sustainability includes taking breaks without guilt, with hard judgment calls rooted in respecting maintainers and community trust.
Django Software Foundation
Last Call 2026 Django Developer Survey
The 2026 survey is ending next week on July 13th. Thank you to everyone who already filled it out. Please encourage all your friends and colleagues to do the same. This is the single most important tool for collecting data from the Django community and directly influences the work of Fellows and new features.
Updates to Django
Today, "Updates to Django" is presented by Raffaella from Djangonaut Space! 🚀
Last week we had 6 pull requests merged into Django by 5 different contributors
Some interesting post from the Django Forum:
- Feedback wanted: pluggable migration recorder (MIGRATION_RECORDER setting)
- PostgreSQL: compile __in lookup to "= ANY(%s)" to avoid O(N) placeholder rewrite
- Implementing a Formal Experimental API for Django
Sponsored Link
You can have a great manager and still want an outside perspective. I explain why in my FAQ.
Articles
The Missing Link: Thinking in Use Cases with Django Query Selectors
Where your queries should live - and how selectors keep your business logic lean and readable.
The Missing Link: Thinking in Use Cases with Django Query Selectors
Atomic, chainable queryset methods answer how you fetch; selectors answer what you are fetching for. Move each read use case into a named, testable function that composes CQS methods, so views and services stay thin and business logic stops spreading across views and forms.
Nifty Django Feature: resolve function
Django's resolve() turns a request path into a ResolverMatch, giving you the target view function, extracted kwargs like pet_id, and the URL name. The same mechanism can be applied to your web server logs to reconstruct which views users hit over time, as long as you track URL changes between deployments.
How to Read Postgres EXPLAIN: A Guide to Scan Types
Scan type in a Postgres EXPLAIN plan tells you whether the database reads the whole table, walks an index, builds a bitmap, or even satisfies the query entirely from an index (index-only scan). This guide walks through sequential, index, bitmap heap, parallel variants, and index-only scans so you can spot why a query is slow and what the planner is optimizing for.
Why we built yet another Postgres connection pooler
Connection poolers often break session state, forcing apps to stop relying on SET and sidelining LISTEN/NOTIFY semantics. PgDog adds a SQL-aware layer that tracks SET variables per client and proxies LISTEN/NOTIFY across processes while preserving transactional behavior, so scaling doesn't mean rewriting core Postgres usage.
A small proposal to form rendering in Django
A code example around this new feature idea, which is an extension to Django's form rendering capabilities to include widgets templates inside a form renderer.
Fixing the dictionary with Python 3.14
A Hugo van Kemenade look at "And now for something completely different" in the Python 3.14 cycle starts with the π symbol and an Oxford English Dictionary markup mistake. The reported rendering bug was fixed within about a year, highlighting how even reference sites can need careful dictionary-grade scrutiny.
How to publish to PyPI using GitHub Actions securely
GitHub Actions incidents have pushed many teams to tighten publishing workflows, and this guide lays out three practical steps for PyPI publishing: run zizmor, remove overly broad GITHUB_TOKEN permissions and persisted checkout credentials, and pin actions to commit SHAs. It also recommends using PyPI Trusted Publishing with a GitHub environment that requires an approval gate before releases.
Videos
Updates on Django's Async Story - Talk Python Live Stream
Carlton Gibson joined host Michael Kennedy to provide an in-depth look at Django's ongoing async story, where it stands now, and what to expect in future releases.
Django Fellow Reports
Jacob Walls
Jacob is on vacation this week.
Natalia Bidart
Intense week! ✨ I was mostly covering solo this week ⛑️, so it was a mix of keeping everything moving and diving deep where needed. A big chunk of time went into tracking down and fixing a docs build regression for the website (thanks Carlton for spotting it and Tobias for the help debugging), which uncovered a subtle mismatch between how Django (core) builds docs and how the website consumes them. Alongside that, I spent time on a few deeper investigations that had been lingering (snoozed over and over in my inbox ⏰), finally unblocking design questions and follow-ups that needed proper attention. On the security side 🔐, I handled prenotifications and a wave of incoming reports, closing out a number of invalid ones and keeping things tidy.
Overall, a very hands-on week 🧰 balancing throughput with some worthwhile deep dives that should pay off going forward ⚖️.
Projects
otto-torino/django-baton
A cool, modern and responsive django admin application based on bootstrap 5 that brings AI to the Django admin.
unfoldadmin/django-unfold
A modern Django Admin approach.
10 Jul 2026 3:00pm GMT