Ticket #14705: patch

File patch, 1.8 KB (added by Klaas van Schelven, 14 years ago)
  • tests/modeltests/model_inheritance/models.py

    diff -r 1a5661fe179d tests/modeltests/model_inheritance/models.py
    a b  
    119119    def __unicode__(self):
    120120        return u"%s the parking lot" % self.name
    121121
     122class AbstractModelOne(models.Model):
     123    field_one = models.BooleanField()
     124
     125    class Meta:
     126        abstract = True
     127 
     128class AbstractModelTwo(models.Model):
     129    field_two = models.BooleanField()
     130
     131    class Meta:
     132        abstract = True
     133 
     134class OneTwo(AbstractModelOne, AbstractModelTwo):
     135    pass
     136
     137class TwoOne(AbstractModelTwo, AbstractModelOne):
     138    pass
     139
    122140#
    123141# Abstract base classes with related models where the sub-class has the
    124142# same name in a different app and inherits from the same abstract base
  • tests/modeltests/model_inheritance/tests.py

    diff -r 1a5661fe179d tests/modeltests/model_inheritance/tests.py
    a b  
    44from django.test import TestCase
    55
    66from models import (Chef, CommonInfo, ItalianRestaurant, ParkingLot, Place,
    7     Post, Restaurant, Student, StudentWorker, Supplier, Worker)
     7    Post, Restaurant, Student, StudentWorker, Supplier, Worker, OneTwo, TwoOne)
    88
    99
    1010class ModelInheritanceTests(TestCase):
     
    269269        self.assertNumQueries(1,
    270270            lambda: ItalianRestaurant.objects.select_related("chef")[0].chef
    271271        )
     272
     273        names = [field.name for field in OneTwo._meta.fields]
     274        self.assertEqual(["id", "field_one", "field_two"], names)
     275
     276        names = [field.name for field in TwoOne._meta.fields]
     277        self.assertEqual(["id", "field_two", "field_one"], names)
     278
Back to Top