2 Regression tests for defer() / only() behavior.
5 from django
.db
import models
8 class Item(models
.Model
):
9 name
= models
.CharField(max_length
=15)
10 text
= models
.TextField(default
="xyzzy")
11 value
= models
.IntegerField()
12 other_value
= models
.IntegerField(default
=0)
14 def __unicode__(self
):
17 class RelatedItem(models
.Model
):
18 item
= models
.ForeignKey(Item
)
20 class Child(models
.Model
):
21 name
= models
.CharField(max_length
=10)
22 value
= models
.IntegerField()
24 class Leaf(models
.Model
):
25 name
= models
.CharField(max_length
=10)
26 child
= models
.ForeignKey(Child
)
27 second_child
= models
.ForeignKey(Child
, related_name
="other", null
=True)
28 value
= models
.IntegerField(default
=42)
30 def __unicode__(self
):
33 class ResolveThis(models
.Model
):
34 num
= models
.FloatField()
35 name
= models
.CharField(max_length
=16)
41 class SimpleItem(models
.Model
):
42 name
= models
.CharField(max_length
=15)
43 value
= models
.IntegerField()
45 def __unicode__(self
):
48 class Feature(models
.Model
):
49 item
= models
.ForeignKey(SimpleItem
)