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:
parent
875d215818
commit
a8efa34283
0
tests/modeltests/model_inheritance/__init__.py
Normal file
0
tests/modeltests/model_inheritance/__init__.py
Normal file
27
tests/modeltests/model_inheritance/models.py
Normal file
27
tests/modeltests/model_inheritance/models.py
Normal 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']
|
||||
|
||||
"""
|
Loading…
x
Reference in New Issue
Block a user