2007-11-05 13:59:42 +00:00
|
|
|
"""
|
|
|
|
Tests for field subclassing.
|
|
|
|
"""
|
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2007-11-05 13:59:42 +00:00
|
|
|
from django.db import models
|
|
|
|
from django.utils.encoding import force_unicode
|
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
from .fields import SmallField, SmallerField, JSONField
|
2007-11-05 13:59:42 +00: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-02 18:40:53 +00:00
|
|
|
class OtherModel(models.Model):
|
|
|
|
data = SmallerField()
|
|
|
|
|
2010-02-24 19:06:59 +00:00
|
|
|
class DataModel(models.Model):
|
|
|
|
data = JSONField()
|