mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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.
		
			
				
	
	
		
			11 lines
		
	
	
		
			242 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			242 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 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
 |