django-concurrency
Optimistic lock implementation for Django. Prevents users from doing concurrent editing
Decision gist · record as of 2026-08-14
Yes. django-concurrency is actively maintained, has no external dependencies, supports current Django and Python versions, carries an MIT license, and solves a real problem in multi-user Django applications. Install it if your application allows concurrent editing and you need to detect and handle conflicts rather than silently overwriting data.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django 4.2 or later and Python 3.10 or later.
- Low install friction with no runtime dependencies.
- Actively maintained with recent commits and support for current Django versions (4.2, 5.2, 6.0) and Python 3.10–3.13.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial Django projects.
last release 2026-04-08 (128 days) · last repo commit 2026-08-09 · 466 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 216,547 downloads/mo, #9,375 on PyPI
Alternatives
Verify before relying
pip install django-concurrency
from concurrency.fields import IntegerVersionField
from django.db import models
class MyModel(models.Model):
version = IntegerVersionField()
name = models.CharField(max_length=100)
# Now concurrent saves raise RecordModifiedError- Whether the package works with all listed Django versions (4.2, 5.2, 6.0) without known issues or edge cases.
- Performance impact of version field checks on models with high write concurrency.
- Whether TriggerVersionField requires specific database support or configuration beyond standard Django setup.
What it is and what it does
django-concurrency implements optimistic locking for Django models by adding a version field that increments on each save. When two users fetch the same record and both try to save changes, the second save fails with a RecordModifiedError, alerting the application that a conflict occurred. This prevents silent data loss in concurrent editing scenarios.
The package works by intercepting model saves and comparing the current version field value against what was fetched from the database. It can be applied to any Django model, including those from third-party packages like django.contrib.auth. It handles Django admin list-editable changeists, admin actions, and can even detect changes made outside Django (via database tools) using a TriggerVersionField variant. No runtime dependencies are required beyond Django itself.
Use it for
- Prevent data loss when multiple users edit the same Django model instance simultaneously in a web application.
- Detect and handle concurrent modifications in Django admin changeists with list-editable fields.
- Intercept concurrent changes made outside the Django application (e.g., direct database edits via pgAdmin or phpMyAdmin).
- Manage concurrency conflicts in Django admin bulk actions on multiple records.
- Implement custom conflict handling logic using ConditionalVersionField for complex business rules.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
django-concurrency is actively maintained, has no external dependencies, supports current Django and Python versions, carries an MIT license, and solves a real problem in multi-user Django applications. Install it if your application allows concurrent editing and you need to detect and handle conflicts rather than silently overwriting data.
Install
django-concurrency on PyPI
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent commits and support for current Django versions (4.2, 5.2, 6.0) and Python 3.10–3.13.
Requires Django 4.2 or later and Python 3.10 or later.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial Django projects.
Quickstart
pip install django-concurrency
from concurrency.fields import IntegerVersionField
from django.db import models
class MyModel(models.Model):
version = IntegerVersionField()
name = models.CharField(max_length=100)
# Now concurrent saves raise RecordModifiedError
Verify before relying
- Whether the package works with all listed Django versions (4.2, 5.2, 6.0) without known issues or edge cases.
- Performance impact of version field checks on models with high write concurrency.
- Whether TriggerVersionField requires specific database support or configuration beyond standard Django setup.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 128 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 216,547 / month, #9,375 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13 |
Evidence: django_concurrency-2.8.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django optimistic lock”
- django-concurrencyAdds optimistic locking to Django models to prevent concurrent…
- fastrlockA C-level re-entrant lock for CPython that replaces threading.RLock…
- django-pglockProvides Postgres advisory locks, table locks, and lock management…
Give your agent the search over MCP, or paste the wish link into any chat.
More Dynamic Content packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.
Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.
Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.
See also django-pglock · eventsourcing · oslo.concurrency · filelock · django-dirtyfields · pykka · drf-writable-nested · django-add-default-value · django-pglocks · django-ordered-model