models.py 733 B

12345678910111213141516171819202122232425
  1. """
  2. Transactions
  3. Django handles transactions in three different ways. The default is to commit
  4. each transaction upon a write, but you can decorate a function to get
  5. commit-on-success behavior. Alternatively, you can manage the transaction
  6. manually.
  7. """
  8. from __future__ import unicode_literals
  9. from django.db import models
  10. from django.utils.encoding import python_2_unicode_compatible
  11. @python_2_unicode_compatible
  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. class Meta:
  17. ordering = ('first_name', 'last_name')
  18. def __str__(self):
  19. return ("%s %s" % (self.first_name, self.last_name)).strip()