RepoJournal
Django

@django

Python's batteries-included web framework

Pick a date

The Wire · Showcase

DJANGO STRIPS HARDCODED PRIMARY KEYS AHEAD OF NON-INTEGER ID SUPPORT

By RepoJournal · Filed · About Django

Django is systematically removing assumptions that primary keys must be integers, clearing the path for databases like MongoDB that use object IDs.

The framework removed hardcoded Site primary keys across the codebase [1], including a critical fix to runtests.py that now dynamically sets SITE_ID based on the database backend [2]. For MongoDB testing, this switches from hardcoded integer 1 to ObjectId('000000000000000000000001'), unblocking real-world usage of non-integer primary keys. The team also purged integer pk assumptions from AdminCustomQuerysetTest [3], with the same treatment applied elsewhere [4]. This isn't just cleanup. These changes signal Django is preparing for a world where UUIDs, ObjectIds, and other non-integer identifiers are first-class citizens, not edge cases. The deprecation roadmap is being updated to reflect this shift [5], giving extension developers and application authors clear guidance on what's coming. Benchmark infrastructure continues to mature across platforms [6], ensuring performance regressions get caught early.

Action items

References

  1. [1] Removed hardcoded Site pks. django/django
  2. [2] Removed hardcoded Site pks. ↗ django/django
  3. [3] Removed integer pk assumption in AdminCustomQuerysetTest. django/django
  4. [4] Removed integer pk assumption in AdminCustomQuerysetTest. ↗ django/django
  5. [5] Added advancing deprecations to preparing for next release instructions. django/django
  6. [6] Results for ubuntu-latest added [skip ci] django/django-asv

FAQ

What changed in Django on May 25, 2026?
Django is systematically removing assumptions that primary keys must be integers, clearing the path for databases like MongoDB that use object IDs.
What should Django teams do about it?
Review custom code that assumes integer primary keys, especially in Site fixtures and admin querysets • Check deprecation notes when upgrading to the next Django release for primary key handling changes
Which Django repositories shipped on May 25, 2026?
django/django, django/django-asv

Related across the cluster

For your repos

The showcase is a teaser.
Your wire is the product.

Same engine. Different stack. Below: what changes when the wire is yours.

Showcase wire

  • 14 famous open source orgs
  • One wire per day
  • Public, generic
  • Read on the web, when you remember

Your wire

  • Up to 1,500 of your repos - orgs, deps, vendors
  • Morning and evening briefs
  • Action items routed to your team
  • Slack delivery, email, breaking-news CVE alerts

Want a hands-on demo first? Ask a current user for an invite link.