mirror of
https://github.com/django/django.git
synced 2024-11-18 23:44:22 +00:00
c5ef65bcf3
* Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str.
25 lines
499 B
Python
25 lines
499 B
Python
"""
|
|
Tests for field subclassing.
|
|
"""
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from django.db import models
|
|
from django.utils.encoding import force_text
|
|
|
|
from .fields import SmallField, SmallerField, JSONField
|
|
|
|
|
|
class MyModel(models.Model):
|
|
name = models.CharField(max_length=10)
|
|
data = SmallField('small field')
|
|
|
|
def __unicode__(self):
|
|
return force_text(self.name)
|
|
|
|
class OtherModel(models.Model):
|
|
data = SmallerField()
|
|
|
|
class DataModel(models.Model):
|
|
data = JSONField()
|