2007-03-13 09:03:05 +08:00
|
|
|
"""
|
|
|
|
A test spanning all the capabilities of all the serializers.
|
|
|
|
|
2007-05-21 09:29:58 +08:00
|
|
|
This class sets up a model for each model field type
|
2013-05-15 10:31:16 +08:00
|
|
|
(except for image types, because of the Pillow/PIL dependency).
|
2007-03-13 09:03:05 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
2007-05-08 18:59:35 +08:00
|
|
|
from django.contrib.contenttypes import generic
|
2007-03-19 19:57:53 +08:00
|
|
|
from django.contrib.contenttypes.models import ContentType
|
|
|
|
|
2007-05-21 09:29:58 +08:00
|
|
|
# The following classes are for testing basic data
|
2009-04-09 23:09:35 +08:00
|
|
|
# marshalling, including NULL values, where allowed.
|
2007-03-13 09:03:05 +08:00
|
|
|
|
2012-12-15 07:26:08 +08:00
|
|
|
class BinaryData(models.Model):
|
|
|
|
data = models.BinaryField(null=True)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class BooleanData(models.Model):
|
2013-08-12 04:19:09 +08:00
|
|
|
data = models.BooleanField(default=False)
|
2007-05-21 09:29:58 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class CharData(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
data = models.CharField(max_length=30, null=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class DateData(models.Model):
|
|
|
|
data = models.DateField(null=True)
|
|
|
|
|
|
|
|
class DateTimeData(models.Model):
|
|
|
|
data = models.DateTimeField(null=True)
|
|
|
|
|
2007-05-21 09:29:58 +08:00
|
|
|
class DecimalData(models.Model):
|
|
|
|
data = models.DecimalField(null=True, decimal_places=3, max_digits=5)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class EmailData(models.Model):
|
|
|
|
data = models.EmailField(null=True)
|
|
|
|
|
|
|
|
class FileData(models.Model):
|
|
|
|
data = models.FileField(null=True, upload_to='/foo/bar')
|
|
|
|
|
|
|
|
class FilePathData(models.Model):
|
|
|
|
data = models.FilePathField(null=True)
|
|
|
|
|
|
|
|
class FloatData(models.Model):
|
2007-05-21 09:29:58 +08:00
|
|
|
data = models.FloatField(null=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class IntegerData(models.Model):
|
|
|
|
data = models.IntegerField(null=True)
|
|
|
|
|
2009-12-17 23:10:38 +08:00
|
|
|
class BigIntegerData(models.Model):
|
|
|
|
data = models.BigIntegerField(null=True)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
# class ImageData(models.Model):
|
|
|
|
# data = models.ImageField(null=True)
|
|
|
|
|
|
|
|
class IPAddressData(models.Model):
|
|
|
|
data = models.IPAddressField(null=True)
|
|
|
|
|
2011-06-11 21:48:24 +08:00
|
|
|
class GenericIPAddressData(models.Model):
|
|
|
|
data = models.GenericIPAddressField(null=True)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class NullBooleanData(models.Model):
|
|
|
|
data = models.NullBooleanField(null=True)
|
|
|
|
|
|
|
|
class PositiveIntegerData(models.Model):
|
|
|
|
data = models.PositiveIntegerField(null=True)
|
|
|
|
|
|
|
|
class PositiveSmallIntegerData(models.Model):
|
|
|
|
data = models.PositiveSmallIntegerField(null=True)
|
|
|
|
|
|
|
|
class SlugData(models.Model):
|
|
|
|
data = models.SlugField(null=True)
|
|
|
|
|
|
|
|
class SmallData(models.Model):
|
|
|
|
data = models.SmallIntegerField(null=True)
|
|
|
|
|
|
|
|
class TextData(models.Model):
|
|
|
|
data = models.TextField(null=True)
|
|
|
|
|
|
|
|
class TimeData(models.Model):
|
|
|
|
data = models.TimeField(null=True)
|
|
|
|
|
2007-03-19 19:57:53 +08:00
|
|
|
class Tag(models.Model):
|
|
|
|
"""A tag on an item."""
|
|
|
|
data = models.SlugField()
|
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
|
object_id = models.PositiveIntegerField()
|
|
|
|
|
2007-05-08 18:59:35 +08:00
|
|
|
content_object = generic.GenericForeignKey()
|
2007-03-19 19:57:53 +08:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ["data"]
|
|
|
|
|
|
|
|
class GenericData(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
data = models.CharField(max_length=30)
|
2007-03-19 19:57:53 +08:00
|
|
|
|
2007-05-08 18:59:35 +08:00
|
|
|
tags = generic.GenericRelation(Tag)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
# The following test classes are all for validation
|
|
|
|
# of related objects; in particular, forward, backward,
|
|
|
|
# and self references.
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class Anchor(models.Model):
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
"""This is a model that can be used as
|
2007-03-13 09:03:05 +08:00
|
|
|
something for other models to point at"""
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-08-05 13:14:46 +08:00
|
|
|
data = models.CharField(max_length=30)
|
2007-05-14 22:21:00 +08:00
|
|
|
|
2009-11-03 22:02:49 +08:00
|
|
|
class Meta:
|
|
|
|
ordering = ('id',)
|
|
|
|
|
2012-03-13 03:41:31 +08:00
|
|
|
class NaturalKeyAnchorManager(models.Manager):
|
|
|
|
def get_by_natural_key(self, data):
|
|
|
|
return self.get(data=data)
|
|
|
|
|
|
|
|
class NaturalKeyAnchor(models.Model):
|
|
|
|
objects = NaturalKeyAnchorManager()
|
|
|
|
|
|
|
|
data = models.CharField(max_length=100, unique=True)
|
|
|
|
|
|
|
|
def natural_key(self):
|
|
|
|
return (self.data,)
|
|
|
|
|
2007-05-14 22:21:00 +08:00
|
|
|
class UniqueAnchor(models.Model):
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
"""This is a model that can be used as
|
2007-05-14 22:21:00 +08:00
|
|
|
something for other models to point at"""
|
|
|
|
|
2007-08-05 13:14:46 +08:00
|
|
|
data = models.CharField(unique=True, max_length=30)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class FKData(models.Model):
|
|
|
|
data = models.ForeignKey(Anchor, null=True)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2012-03-13 03:41:31 +08:00
|
|
|
class FKDataNaturalKey(models.Model):
|
|
|
|
data = models.ForeignKey(NaturalKeyAnchor, null=True)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class M2MData(models.Model):
|
|
|
|
data = models.ManyToManyField(Anchor, null=True)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class O2OData(models.Model):
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
# One to one field can't be null here, since it is a PK.
|
|
|
|
data = models.OneToOneField(Anchor, primary_key=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class FKSelfData(models.Model):
|
|
|
|
data = models.ForeignKey('self', null=True)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class M2MSelfData(models.Model):
|
|
|
|
data = models.ManyToManyField('self', null=True, symmetrical=False)
|
|
|
|
|
2007-05-14 22:14:49 +08:00
|
|
|
class FKDataToField(models.Model):
|
|
|
|
data = models.ForeignKey(UniqueAnchor, null=True, to_field='data')
|
|
|
|
|
2007-05-28 13:41:32 +08:00
|
|
|
class FKDataToO2O(models.Model):
|
|
|
|
data = models.ForeignKey(O2OData, null=True)
|
|
|
|
|
2008-08-12 20:58:33 +08:00
|
|
|
class M2MIntermediateData(models.Model):
|
|
|
|
data = models.ManyToManyField(Anchor, null=True, through='Intermediate')
|
2009-11-03 22:02:49 +08:00
|
|
|
|
2008-08-12 20:58:33 +08:00
|
|
|
class Intermediate(models.Model):
|
|
|
|
left = models.ForeignKey(M2MIntermediateData)
|
|
|
|
right = models.ForeignKey(Anchor)
|
|
|
|
extra = models.CharField(max_length=30, blank=True, default="doesn't matter")
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
# The following test classes are for validating the
|
|
|
|
# deserialization of objects that use a user-defined
|
|
|
|
# field as the primary key.
|
|
|
|
# Some of these data types have been commented out
|
|
|
|
# because they can't be used as a primary key on one
|
|
|
|
# or all database backends.
|
|
|
|
|
|
|
|
class BooleanPKData(models.Model):
|
2013-08-12 04:19:09 +08:00
|
|
|
data = models.BooleanField(primary_key=True, default=False)
|
Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 10:50:16 +08:00
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class CharPKData(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
data = models.CharField(max_length=30, primary_key=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
# class DatePKData(models.Model):
|
|
|
|
# data = models.DateField(primary_key=True)
|
|
|
|
|
|
|
|
# class DateTimePKData(models.Model):
|
|
|
|
# data = models.DateTimeField(primary_key=True)
|
|
|
|
|
2007-05-21 09:29:58 +08:00
|
|
|
class DecimalPKData(models.Model):
|
|
|
|
data = models.DecimalField(primary_key=True, decimal_places=3, max_digits=5)
|
|
|
|
|
2007-03-13 09:03:05 +08:00
|
|
|
class EmailPKData(models.Model):
|
|
|
|
data = models.EmailField(primary_key=True)
|
|
|
|
|
2008-08-09 04:59:02 +08:00
|
|
|
# class FilePKData(models.Model):
|
|
|
|
# data = models.FileField(primary_key=True, upload_to='/foo/bar')
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class FilePathPKData(models.Model):
|
|
|
|
data = models.FilePathField(primary_key=True)
|
|
|
|
|
|
|
|
class FloatPKData(models.Model):
|
2007-05-21 09:29:58 +08:00
|
|
|
data = models.FloatField(primary_key=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class IntegerPKData(models.Model):
|
|
|
|
data = models.IntegerField(primary_key=True)
|
|
|
|
|
|
|
|
# class ImagePKData(models.Model):
|
|
|
|
# data = models.ImageField(primary_key=True)
|
|
|
|
|
|
|
|
class IPAddressPKData(models.Model):
|
|
|
|
data = models.IPAddressField(primary_key=True)
|
|
|
|
|
2011-06-11 21:48:24 +08:00
|
|
|
class GenericIPAddressPKData(models.Model):
|
|
|
|
data = models.GenericIPAddressField(primary_key=True)
|
|
|
|
|
2007-07-12 19:27:38 +08:00
|
|
|
# This is just a Boolean field with null=True, and we can't test a PK value of NULL.
|
|
|
|
# class NullBooleanPKData(models.Model):
|
|
|
|
# data = models.NullBooleanField(primary_key=True)
|
2007-03-13 09:03:05 +08:00
|
|
|
|
|
|
|
class PositiveIntegerPKData(models.Model):
|
|
|
|
data = models.PositiveIntegerField(primary_key=True)
|
|
|
|
|
|
|
|
class PositiveSmallIntegerPKData(models.Model):
|
|
|
|
data = models.PositiveSmallIntegerField(primary_key=True)
|
|
|
|
|
|
|
|
class SlugPKData(models.Model):
|
|
|
|
data = models.SlugField(primary_key=True)
|
|
|
|
|
|
|
|
class SmallPKData(models.Model):
|
|
|
|
data = models.SmallIntegerField(primary_key=True)
|
|
|
|
|
|
|
|
# class TextPKData(models.Model):
|
|
|
|
# data = models.TextField(primary_key=True)
|
|
|
|
|
|
|
|
# class TimePKData(models.Model):
|
|
|
|
# data = models.TimeField(primary_key=True)
|
|
|
|
|
2007-06-01 21:39:08 +08:00
|
|
|
class ComplexModel(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
field1 = models.CharField(max_length=10)
|
|
|
|
field2 = models.CharField(max_length=10)
|
|
|
|
field3 = models.CharField(max_length=10)
|
2007-07-12 15:45:35 +08:00
|
|
|
|
|
|
|
# Tests for handling fields with pre_save functions, or
|
|
|
|
# models with save functions that modify data
|
|
|
|
class AutoNowDateTimeData(models.Model):
|
|
|
|
data = models.DateTimeField(null=True, auto_now=True)
|
|
|
|
|
|
|
|
class ModifyingSaveData(models.Model):
|
|
|
|
data = models.IntegerField(null=True)
|
|
|
|
|
|
|
|
def save(self):
|
|
|
|
"A save method that modifies the data in the object"
|
|
|
|
self.data = 666
|
|
|
|
super(ModifyingSaveData, self).save(raw)
|
2008-06-09 22:03:35 +08:00
|
|
|
|
|
|
|
# Tests for serialization of models using inheritance.
|
|
|
|
# Regression for #7202, #7350
|
|
|
|
class AbstractBaseModel(models.Model):
|
|
|
|
parent_data = models.IntegerField()
|
|
|
|
class Meta:
|
|
|
|
abstract = True
|
|
|
|
|
|
|
|
class InheritAbstractModel(AbstractBaseModel):
|
|
|
|
child_data = models.IntegerField()
|
2009-11-03 22:02:49 +08:00
|
|
|
|
2008-06-09 22:03:35 +08:00
|
|
|
class BaseModel(models.Model):
|
|
|
|
parent_data = models.IntegerField()
|
|
|
|
|
|
|
|
class InheritBaseModel(BaseModel):
|
|
|
|
child_data = models.IntegerField()
|
|
|
|
|
|
|
|
class ExplicitInheritBaseModel(BaseModel):
|
|
|
|
parent = models.OneToOneField(BaseModel)
|
|
|
|
child_data = models.IntegerField()
|
2010-02-24 23:54:03 +08:00
|
|
|
|
2012-03-04 01:50:18 +08:00
|
|
|
class ProxyBaseModel(BaseModel):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
2012-03-04 05:34:51 +08:00
|
|
|
class ProxyProxyBaseModel(ProxyBaseModel):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
2010-02-24 23:54:03 +08:00
|
|
|
class LengthModel(models.Model):
|
|
|
|
data = models.IntegerField()
|
|
|
|
|
|
|
|
def __len__(self):
|
|
|
|
return self.data
|
2012-03-13 03:41:31 +08:00
|
|
|
|