mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #21803 -- Added support for post-commit callbacks
Made it possible to register and run callbacks after a database transaction is committed with the `transaction.on_commit()` function. This patch is heavily based on Carl Meyers django-transaction-hooks <https://django-transaction-hooks.readthedocs.org/>. Thanks to Aymeric Augustin, Carl Meyer, and Tim Graham for review and feedback.
This commit is contained in:
parent
9f0d67137c
commit
00a1d4d042
7 changed files with 462 additions and 15 deletions
10
tests/transaction_hooks/models.py
Normal file
10
tests/transaction_hooks/models.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Thing(models.Model):
|
||||
num = models.IntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return "Thing %d" % self.num
|
Loading…
Add table
Add a link
Reference in a new issue