~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to tests/modeltests/transactions/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
15. 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 __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
 
    first_name = models.CharField(max_length=30)
18
 
    last_name = models.CharField(max_length=30)
19
 
    email = models.EmailField()
20
 
 
21
 
    class Meta:
22
 
        ordering = ('first_name', 'last_name')
23
 
 
24
 
    def __str__(self):
25
 
        return "%s %s" % (self.first_name, self.last_name)