PageRenderTime 125ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. """
  2. Regression tests for defer() / only() behavior.
  3. """
  4. from django.conf import settings
  5. from django.contrib.contenttypes.models import ContentType
  6. from django.db import connection, models
  7. class Item(models.Model):
  8. name = models.CharField(max_length=15)
  9. text = models.TextField(default="xyzzy")
  10. value = models.IntegerField()
  11. other_value = models.IntegerField(default=0)
  12. def __unicode__(self):
  13. return self.name
  14. class RelatedItem(models.Model):
  15. item = models.ForeignKey(Item)
  16. class Child(models.Model):
  17. name = models.CharField(max_length=10)
  18. value = models.IntegerField()
  19. class Leaf(models.Model):
  20. name = models.CharField(max_length=10)
  21. child = models.ForeignKey(Child)
  22. second_child = models.ForeignKey(Child, related_name="other", null=True)
  23. value = models.IntegerField(default=42)
  24. def __unicode__(self):
  25. return self.name
  26. class ResolveThis(models.Model):
  27. num = models.FloatField()
  28. name = models.CharField(max_length=16)