2009-03-22 09:45:22 +08:00
|
|
|
"""
|
|
|
|
Regression tests for defer() / only() behavior.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.conf import settings
|
2009-04-11 21:22:32 +08:00
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2009-03-22 09:45:22 +08:00
|
|
|
from django.db import connection, models
|
|
|
|
|
|
|
|
class Item(models.Model):
|
2009-04-04 11:21:31 +08:00
|
|
|
name = models.CharField(max_length=15)
|
2009-03-22 09:45:22 +08:00
|
|
|
text = models.TextField(default="xyzzy")
|
|
|
|
value = models.IntegerField()
|
|
|
|
other_value = models.IntegerField(default=0)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2009-04-04 11:21:31 +08:00
|
|
|
class RelatedItem(models.Model):
|
|
|
|
item = models.ForeignKey(Item)
|
|
|
|
|
2009-04-04 13:34:23 +08: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 13:35:01 +08:00
|
|
|
second_child = models.ForeignKey(Child, related_name="other", null=True)
|
2009-04-04 13:34:23 +08:00
|
|
|
value = models.IntegerField(default=42)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2009-12-22 23:18:51 +08:00
|
|
|
class ResolveThis(models.Model):
|
|
|
|
num = models.FloatField()
|
|
|
|
name = models.CharField(max_length=16)
|
2011-05-15 08:56:01 +08:00
|
|
|
|
|
|
|
class Proxy(Item):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|