2008-06-29 09:39:32 +00:00
|
|
|
"""
|
|
|
|
Regression tests for the interaction between model inheritance and
|
|
|
|
select_related().
|
|
|
|
"""
|
2012-06-07 16:08:47 +00:00
|
|
|
from __future__ import unicode_literals
|
2008-06-29 09:39:32 +00:00
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 21:34:56 +00:00
|
|
|
|
2008-06-29 09:39:32 +00:00
|
|
|
class Place(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('name',)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-06-07 16:08:47 +00:00
|
|
|
return "%s the place" % self.name
|
2008-06-29 09:39:32 +00:00
|
|
|
|
|
|
|
class Restaurant(Place):
|
|
|
|
serves_sushi = models.BooleanField()
|
|
|
|
serves_steak = models.BooleanField()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-06-07 16:08:47 +00:00
|
|
|
return "%s the restaurant" % self.name
|
2008-06-29 09:39:32 +00:00
|
|
|
|
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
favorite_restaurant = models.ForeignKey(Restaurant)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|