App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / regressiontests / defer_regress / models.py
blob812d2da2063439d5b67a3d7d8254a13b043636e5
1 """
2 Regression tests for defer() / only() behavior.
3 """
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):
15 return self.name
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):
31 return self.name
33 class ResolveThis(models.Model):
34 num = models.FloatField()
35 name = models.CharField(max_length=16)
37 class Proxy(Item):
38 class Meta:
39 proxy = True
41 class SimpleItem(models.Model):
42 name = models.CharField(max_length=15)
43 value = models.IntegerField()
45 def __unicode__(self):
46 return self.name
48 class Feature(models.Model):
49 item = models.ForeignKey(SimpleItem)