2006-05-02 01:31:56 +00:00
|
|
|
"""
|
2014-09-24 05:13:13 +00:00
|
|
|
Transactions
|
2006-05-02 01:31:56 +00:00
|
|
|
|
|
|
|
Django handles transactions in three different ways. The default is to commit
|
|
|
|
each transaction upon a write, but you can decorate a function to get
|
|
|
|
commit-on-success behavior. Alternatively, you can manage the transaction
|
|
|
|
manually.
|
|
|
|
"""
|
2011-07-13 09:35:51 +00:00
|
|
|
from django.db import models
|
2012-08-12 10:32:08 +00:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2006-05-02 01:31:56 +00:00
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
@python_2_unicode_compatible
|
2006-05-02 01:31:56 +00:00
|
|
|
class Reporter(models.Model):
|
2007-08-05 05:14:46 +00:00
|
|
|
first_name = models.CharField(max_length=30)
|
|
|
|
last_name = models.CharField(max_length=30)
|
2006-05-02 01:31:56 +00:00
|
|
|
email = models.EmailField()
|
|
|
|
|
2009-06-29 12:29:48 +00:00
|
|
|
class Meta:
|
|
|
|
ordering = ('first_name', 'last_name')
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2013-03-04 21:17:35 +00:00
|
|
|
return ("%s %s" % (self.first_name, self.last_name)).strip()
|