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

« back to all changes in this revision

Viewing changes to tests/modeltests/order_with_respect_to/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:
3
3
"""
4
4
 
5
5
from django.db import models
 
6
from django.utils import six
 
7
from django.utils.encoding import python_2_unicode_compatible
6
8
 
7
9
 
8
10
class Question(models.Model):
9
11
    text = models.CharField(max_length=200)
10
12
 
 
13
@python_2_unicode_compatible
11
14
class Answer(models.Model):
12
15
    text = models.CharField(max_length=200)
13
16
    question = models.ForeignKey(Question)
15
18
    class Meta:
16
19
        order_with_respect_to = 'question'
17
20
 
18
 
    def __unicode__(self):
19
 
        return unicode(self.text)
 
21
    def __str__(self):
 
22
        return six.text_type(self.text)
20
23
 
 
24
@python_2_unicode_compatible
21
25
class Post(models.Model):
22
26
    title = models.CharField(max_length=200)
23
27
    parent = models.ForeignKey("self", related_name="children", null=True)
25
29
    class Meta:
26
30
        order_with_respect_to = "parent"
27
31
 
28
 
    def __unicode__(self):
 
32
    def __str__(self):
29
33
        return self.title