Mohamed Feddad

65%
Flag icon
Row-level locks are done in Django by calling select_for_update() on your QuerySet within a transaction. Consider this example: with transaction.atomic():     feed = Feed.objects.select_for_update().get(id=id)     feed.html = sanitize(feed.html)     feed.save() By using select_for_update, we lock the Feed object's row until the transaction is done.
Django Design Patterns and Best Practices: Industry-standard web development techniques and solutions using Python, 2nd Edition
Rate this book
Clear rating