mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
Oracle doesn't like grouping by TextField, so use CharFields instead in
models.
Backport of 728d3fe1ba from master
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
"""
|
|
Tests for defer() and only().
|
|
"""
|
|
|
|
from django.db import models
|
|
from django.utils.encoding import python_2_unicode_compatible
|
|
|
|
|
|
class Secondary(models.Model):
|
|
first = models.CharField(max_length=50)
|
|
second = models.CharField(max_length=50)
|
|
|
|
@python_2_unicode_compatible
|
|
class Primary(models.Model):
|
|
name = models.CharField(max_length=50)
|
|
value = models.CharField(max_length=50)
|
|
related = models.ForeignKey(Secondary)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class Child(Primary):
|
|
pass
|
|
|
|
class BigChild(Primary):
|
|
other = models.CharField(max_length=50)
|
|
|
|
class ChildProxy(Child):
|
|
class Meta:
|
|
proxy=True
|
|
|
|
class Profile(models.Model):
|
|
profile1 = models.CharField(max_length=1000, default='profile1')
|
|
|
|
class Location(models.Model):
|
|
location1 = models.CharField(max_length=1000, default='location1')
|
|
|
|
class Item(models.Model):
|
|
pass
|
|
|
|
class Request(models.Model):
|
|
profile = models.ForeignKey(Profile, null=True, blank=True)
|
|
location = models.ForeignKey(Location)
|
|
items = models.ManyToManyField(Item)
|
|
|
|
request1 = models.CharField(default='request1', max_length=1000)
|
|
request2 = models.CharField(default='request2', max_length=1000)
|
|
request3 = models.CharField(default='request3', max_length=1000)
|
|
request4 = models.CharField(default='request4', max_length=1000)
|