2009-03-22 01:45:22 +00:00
|
|
|
"""
|
|
|
|
Regression tests for defer() / only() behavior.
|
|
|
|
"""
|
|
|
|
|
2011-07-13 09:35:51 +00:00
|
|
|
from django.db import models
|
2009-03-22 01:45:22 +00:00
|
|
|
|
2011-10-13 18:51:33 +00:00
|
|
|
|
2009-03-22 01:45:22 +00:00
|
|
|
class Item(models.Model):
|
2009-04-04 03:21:31 +00:00
|
|
|
name = models.CharField(max_length=15)
|
2009-03-22 01:45:22 +00:00
|
|
|
text = models.TextField(default="xyzzy")
|
|
|
|
value = models.IntegerField()
|
|
|
|
other_value = models.IntegerField(default=0)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2009-04-04 03:21:31 +00:00
|
|
|
class RelatedItem(models.Model):
|
|
|
|
item = models.ForeignKey(Item)
|
|
|
|
|
2009-04-04 05:34:23 +00:00
|
|
|
class Child(models.Model):
|
|
|
|
name = models.CharField(max_length=10)
|
|
|
|
value = models.IntegerField()
|
|
|
|
|
|
|
|
class Leaf(models.Model):
|
|
|
|
name = models.CharField(max_length=10)
|
|
|
|
child = models.ForeignKey(Child)
|
2009-04-04 05:35:01 +00:00
|
|
|
second_child = models.ForeignKey(Child, related_name="other", null=True)
|
2009-04-04 05:34:23 +00:00
|
|
|
value = models.IntegerField(default=42)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2009-12-22 15:18:51 +00:00
|
|
|
class ResolveThis(models.Model):
|
|
|
|
num = models.FloatField()
|
|
|
|
name = models.CharField(max_length=16)
|
2011-05-15 00:56:01 +00:00
|
|
|
|
|
|
|
class Proxy(Item):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
2011-07-17 22:22:39 +00:00
|
|
|
|
|
|
|
class SimpleItem(models.Model):
|
|
|
|
name = models.CharField(max_length=15)
|
|
|
|
value = models.IntegerField()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Feature(models.Model):
|
|
|
|
item = models.ForeignKey(SimpleItem)
|
2012-06-26 15:08:42 +00:00
|
|
|
|
|
|
|
class ItemAndSimpleItem(models.Model):
|
|
|
|
item = models.ForeignKey(Item)
|
|
|
|
simple = models.ForeignKey(SimpleItem)
|