# How to Manage Concurrency in Django Models

DevFeed: [How to Manage Concurrency in Django Models](<https://devfeed.tech/articles/how-to-manage-concurrency-in-django-models-33909.md>)

Original publisher: [Read original article](<https://hakibenita.com/how-to-manage-concurrency-in-django-models>)

Author: Haki Benita

Published: 2017-07-06T21:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Django](<https://devfeed.tech/topics/django.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [web applications](<https://devfeed.tech/topics/web-applications.md>)

Tags: [articles](<https://devfeed.tech/tags/articles.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [databases](<https://devfeed.tech/tags/databases.md>), [django](<https://devfeed.tech/tags/django.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [locking](<https://devfeed.tech/tags/locking.md>), [locks](<https://devfeed.tech/tags/locks.md>), [models](<https://devfeed.tech/tags/models.md>), [orm](<https://devfeed.tech/tags/orm.md>)

## AI overview

This tutorial explains concurrency problems in Django models using a bank account example. It shows how simultaneous updates can produce a stale-balance error and describes using database locks and transactions with a pessimistic approach to maintain consistency.

## Source excerpt

The days of desktop systems serving single users are long gone. Web applications nowadays are serving millions of users at the same time. With many users comes a wide range of new problems: concurrency problems. In this article we describe two approaches for managing concurrency in Django models.