1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

magic-removal: added trivial tests for model inheritance.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-03-08 20:08:05 +00:00
parent 875d215818
commit a8efa34283
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
"""
XX. Model inheritance
"""
from django.db import models
class Place(models.Model):
name = models.CharField(maxlength=50)
address = models.CharField(maxlength=80)
def __repr__(self):
return "%s the place" % self.name
class Restaurant(Place):
serves_hot_dogs = models.BooleanField()
serves_pizza = models.BooleanField()
def __repr__(self):
return "%s the restaurant" % self.name
API_TESTS = """
# Make sure Restaurant has the right fields in the right order.
>>> [f.name for f in Restaurant._meta.fields]
['id', 'name', 'address', 'serves_hot_dogs', 'serves_pizza']
"""