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

« back to all changes in this revision

Viewing changes to tests/regressiontests/model_inheritance_select_related/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:
2
2
Regression tests for the interaction between model inheritance and
3
3
select_related().
4
4
"""
 
5
from __future__ import unicode_literals
5
6
 
6
7
from django.db import models
7
 
 
8
 
 
 
8
from django.utils.encoding import python_2_unicode_compatible
 
9
 
 
10
 
 
11
@python_2_unicode_compatible
9
12
class Place(models.Model):
10
13
    name = models.CharField(max_length=50)
11
14
 
12
15
    class Meta:
13
16
        ordering = ('name',)
14
17
 
15
 
    def __unicode__(self):
16
 
        return u"%s the place" % self.name
 
18
    def __str__(self):
 
19
        return "%s the place" % self.name
17
20
 
 
21
@python_2_unicode_compatible
18
22
class Restaurant(Place):
19
23
    serves_sushi = models.BooleanField()
20
24
    serves_steak = models.BooleanField()
21
25
 
22
 
    def __unicode__(self):
23
 
        return u"%s the restaurant" % self.name
 
26
    def __str__(self):
 
27
        return "%s the restaurant" % self.name
24
28
 
 
29
@python_2_unicode_compatible
25
30
class Person(models.Model):
26
31
    name = models.CharField(max_length=50)
27
32
    favorite_restaurant = models.ForeignKey(Restaurant)
28
33
 
29
 
    def __unicode__(self):
 
34
    def __str__(self):
30
35
        return self.name