PageRenderTime 81ms CodeModel.GetById 74ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/defer_regress/models.py

https://code.google.com/p/mango-py/
Python | 36 lines | 25 code | 8 blank | 3 comment | 0 complexity | 7643d72a8ce48b802d19ce7f30554ca3 MD5 | raw file
 1"""
 2Regression tests for defer() / only() behavior.
 3"""
 4
 5from django.conf import settings
 6from django.contrib.contenttypes.models import ContentType
 7from django.db import connection, models
 8
 9class Item(models.Model):
10    name = models.CharField(max_length=15)
11    text = models.TextField(default="xyzzy")
12    value = models.IntegerField()
13    other_value = models.IntegerField(default=0)
14
15    def __unicode__(self):
16        return self.name
17
18class RelatedItem(models.Model):
19    item = models.ForeignKey(Item)
20
21class Child(models.Model):
22    name = models.CharField(max_length=10)
23    value = models.IntegerField()
24
25class Leaf(models.Model):
26    name = models.CharField(max_length=10)
27    child = models.ForeignKey(Child)
28    second_child = models.ForeignKey(Child, related_name="other", null=True)
29    value = models.IntegerField(default=42)
30
31    def __unicode__(self):
32        return self.name
33
34class ResolveThis(models.Model):
35    num = models.FloatField()
36    name = models.CharField(max_length=16)