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