1. """
    
  2. Transactions
    
  3. 
    
  4. Django handles transactions in three different ways. The default is to commit
    
  5. each transaction upon a write, but you can decorate a function to get
    
  6. commit-on-success behavior. Alternatively, you can manage the transaction
    
  7. manually.
    
  8. """
    
  9. from django.db import models
    
  10. 
    
  11. 
    
  12. class Reporter(models.Model):
    
  13.     first_name = models.CharField(max_length=30)
    
  14.     last_name = models.CharField(max_length=30)
    
  15.     email = models.EmailField()
    
  16. 
    
  17.     class Meta:
    
  18.         ordering = ("first_name", "last_name")
    
  19. 
    
  20.     def __str__(self):
    
  21.         return ("%s %s" % (self.first_name, self.last_name)).strip()