Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!


Project description


This small library provides helpers for updating Django model objects without race conditions.


pip install django-object-utils


from django_object_utils import reload_object, update_object, lock_object

user = User.objects.get(pk=1)

# Reload object in-place with the latest version from the database

# Run SQL UPDATE for certain fields only and update the Python object
update_object(user, username='john', email='')

# Run SQL UPDATE and then reload the object from the database
update_object(user, balance=F('balance')+payment, reload=True)

if request.method == 'POST':
        with transaction.atomic():
                # Enter a critical section and ensure that the object is the latest version.
                # Use the corresponding database row as the synchronization monitor.
                form = UserForm(data=request.POST)

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-object-utils-0.0.1.tar.gz (1.8 kB) Copy SHA256 hash SHA256 Source None Jul 15, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page