summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_inheritance/models.py8
-rw-r--r--tests/modeltests/model_inheritance/tests.py6
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/modeltests/model_inheritance/models.py b/tests/modeltests/model_inheritance/models.py
index 6cee512fb3..a0fed8a5cc 100644
--- a/tests/modeltests/model_inheritance/models.py
+++ b/tests/modeltests/model_inheritance/models.py
@@ -143,3 +143,11 @@ class Copy(NamedURL):
def __unicode__(self):
return self.content
+
+class Mixin(object):
+ def __init__(self):
+ self.other_attr = 1
+ super(Mixin, self).__init__()
+
+class MixinModel(models.Model, Mixin):
+ pass
diff --git a/tests/modeltests/model_inheritance/tests.py b/tests/modeltests/model_inheritance/tests.py
index 34c136d58b..334297ae12 100644
--- a/tests/modeltests/model_inheritance/tests.py
+++ b/tests/modeltests/model_inheritance/tests.py
@@ -4,7 +4,7 @@ from django.core.exceptions import FieldError
from django.test import TestCase
from models import (Chef, CommonInfo, ItalianRestaurant, ParkingLot, Place,
- Post, Restaurant, Student, StudentWorker, Supplier, Worker)
+ Post, Restaurant, Student, StudentWorker, Supplier, Worker, MixinModel)
class ModelInheritanceTests(TestCase):
@@ -269,3 +269,7 @@ class ModelInheritanceTests(TestCase):
self.assertNumQueries(1,
lambda: ItalianRestaurant.objects.select_related("chef")[0].chef
)
+
+ def test_mixin_init(self):
+ m = MixinModel()
+ self.assertEqual(m.other_attr, 1)