| 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 |
|
| 10 |
from django.db import models |
| 11 |
|
| 12 |
|
| 13 |
class Reporter(models.Model): |
| 14 |
first_name = models.CharField(max_length=30) |
| 15 |
last_name = models.CharField(max_length=30) |
| 16 |
email = models.EmailField() |
| 17 |
|
| 18 |
class Meta: |
| 19 |
ordering = ("first_name", "last_name") |
| 20 |
|
| 21 |
def __str__(self): |
| 22 |
return ("%s %s" % (self.first_name, self.last_name)).strip() |