From a8efa342834319b3eb468e4f574a8a8ba740a58f Mon Sep 17 00:00:00 2001 From: Joseph Kocherhans Date: Wed, 8 Mar 2006 20:08:05 +0000 Subject: [PATCH] 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 --- .../modeltests/model_inheritance/__init__.py | 0 tests/modeltests/model_inheritance/models.py | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/modeltests/model_inheritance/__init__.py create mode 100644 tests/modeltests/model_inheritance/models.py diff --git a/tests/modeltests/model_inheritance/__init__.py b/tests/modeltests/model_inheritance/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/modeltests/model_inheritance/models.py b/tests/modeltests/model_inheritance/models.py new file mode 100644 index 0000000000..0f9dd19f5d --- /dev/null +++ b/tests/modeltests/model_inheritance/models.py @@ -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'] + +"""