~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to tests/regressiontests/extra_regress/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import unicode_literals
 
2
 
1
3
import copy
2
4
import datetime
3
5
 
4
6
from django.contrib.auth.models import User
5
7
from django.db import models
6
 
 
7
 
 
 
8
from django.utils.encoding import python_2_unicode_compatible
 
9
 
 
10
 
 
11
@python_2_unicode_compatible
8
12
class RevisionableModel(models.Model):
9
13
    base = models.ForeignKey('self', null=True)
10
14
    title = models.CharField(blank=True, max_length=255)
11
15
    when = models.DateTimeField(default=datetime.datetime.now)
12
16
 
13
 
    def __unicode__(self):
14
 
        return u"%s (%s, %s)" % (self.title, self.id, self.base.id)
 
17
    def __str__(self):
 
18
        return "%s (%s, %s)" % (self.title, self.id, self.base.id)
15
19
 
16
20
    def save(self, *args, **kwargs):
17
21
        super(RevisionableModel, self).save(*args, **kwargs)
30
34
    created_by = models.ForeignKey(User)
31
35
    text = models.TextField()
32
36
 
 
37
@python_2_unicode_compatible
33
38
class TestObject(models.Model):
34
39
    first = models.CharField(max_length=20)
35
40
    second = models.CharField(max_length=20)
36
41
    third = models.CharField(max_length=20)
37
42
 
38
 
    def __unicode__(self):
39
 
        return u'TestObject: %s,%s,%s' % (self.first,self.second,self.third)
 
43
    def __str__(self):
 
44
        return 'TestObject: %s,%s,%s' % (self.first,self.second,self.third)
40
45