2007-11-05 21:59:42 +08:00
|
|
|
"""
|
|
|
|
Tests for field subclassing.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
from django.utils.encoding import force_unicode
|
|
|
|
|
2011-07-13 17:35:51 +08:00
|
|
|
from fields import SmallField, SmallerField, JSONField
|
2007-11-05 21:59:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
class MyModel(models.Model):
|
|
|
|
name = models.CharField(max_length=10)
|
|
|
|
data = SmallField('small field')
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return force_unicode(self.name)
|
|
|
|
|
2010-11-03 02:40:53 +08:00
|
|
|
class OtherModel(models.Model):
|
|
|
|
data = SmallerField()
|
|
|
|
|
2010-02-25 03:06:59 +08:00
|
|
|
class DataModel(models.Model):
|
|
|
|
data = JSONField()
|