models.py 733 Bytes
Newer Older
1
"""
2
Transactions
3 4 5 6 7 8

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.
"""
9
from __future__ import unicode_literals
10

11
from django.db import models
12
from django.utils.encoding import python_2_unicode_compatible
13

14

15
@python_2_unicode_compatible
16
class Reporter(models.Model):
17 18
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
19 20
    email = models.EmailField()

21 22 23
    class Meta:
        ordering = ('first_name', 'last_name')

24
    def __str__(self):
25
        return ("%s %s" % (self.first_name, self.last_name)).strip()