2009-03-19 17:06:04 +08:00
|
|
|
"""
|
|
|
|
Tests for defer() and only().
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2010-09-13 04:03:20 +08:00
|
|
|
|
2009-03-19 17:06:04 +08:00
|
|
|
|
|
|
|
class Secondary(models.Model):
|
|
|
|
first = models.CharField(max_length=50)
|
|
|
|
second = models.CharField(max_length=50)
|
|
|
|
|
2013-11-03 06:50:35 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2009-03-19 17:06:04 +08:00
|
|
|
class Primary(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
value = models.CharField(max_length=50)
|
|
|
|
related = models.ForeignKey(Secondary)
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2009-03-20 06:46:28 +08:00
|
|
|
return self.name
|
|
|
|
|
2013-11-03 06:50:35 +08:00
|
|
|
|
2009-06-06 14:14:05 +08:00
|
|
|
class Child(Primary):
|
|
|
|
pass
|
|
|
|
|
2013-11-03 06:50:35 +08:00
|
|
|
|
2009-06-06 14:14:05 +08:00
|
|
|
class BigChild(Primary):
|
|
|
|
other = models.CharField(max_length=50)
|
2012-03-13 06:33:18 +08:00
|
|
|
|
2013-11-03 06:50:35 +08:00
|
|
|
|
2012-03-13 06:33:18 +08:00
|
|
|
class ChildProxy(Child):
|
|
|
|
class Meta:
|
2013-10-23 18:09:29 +08:00
|
|
|
proxy = True
|