Package expedient :: Package common :: Package extendable :: Package tests :: Module models
[hide private]
[frames] | no frames]

Source Code for Module expedient.common.extendable.tests.models

 1  ''' 
 2  @author: jnaous 
 3  ''' 
 4  from django.db import models 
 5  from expedient.common.extendable.models import Extendable 
 6   
7 -class OtherModel(models.Model): pass
8
9 -class OtherModelRel(models.Model):
10 child = models.ForeignKey("TestChild") 11 other = models.ForeignKey(OtherModel)
12
13 -class YetAnotherModel(models.Model): pass
14
15 -class YetAnotherModelRel(models.Model):
16 child = models.ForeignKey("TestOtherChild") 17 other = models.ForeignKey(YetAnotherModel)
18
19 -class TestParent(Extendable):
20 - class Extend:
21 fields = { 22 'other': (models.ManyToManyField, 23 [None], 24 {'through': None}, 25 ['other_model'], 26 {'through': 'other_through'}, 27 ), 28 } 29 mandatory = [ 30 'other_model', 31 'other_through', 32 ]
33
34 -class TestChild(TestParent):
35 - class Extend:
36 replacements = { 37 'other_model': OtherModel, 38 'other_through': OtherModelRel, 39 }
40
41 -class TestOtherChild(TestParent):
42 - class Extend:
43 replacements = { 44 'other_model': YetAnotherModel, 45 'other_through': YetAnotherModelRel, 46 }
47