Fixed #31777 -- Added support for database collations to Char/TextFields.

Thanks Simon Charette and Mariusz Felisiak for reviews.
This commit is contained in:
Tom Carrick 2020-07-18 13:17:39 +02:00 committed by Mariusz Felisiak
parent ba6b32e5ef
commit e387f191f7
25 changed files with 544 additions and 30 deletions

View file

@ -2,7 +2,7 @@ from unittest import skipIf
from django import forms
from django.db import connection, models
from django.test import TestCase
from django.test import SimpleTestCase, TestCase
from .models import Post
@ -37,3 +37,13 @@ class TextFieldTests(TestCase):
p = Post.objects.create(title='Whatever', body='Smile 😀.')
p.refresh_from_db()
self.assertEqual(p.body, 'Smile 😀.')
class TestMethods(SimpleTestCase):
def test_deconstruct(self):
field = models.TextField()
*_, kwargs = field.deconstruct()
self.assertEqual(kwargs, {})
field = models.TextField(db_collation='utf8_esperanto_ci')
*_, kwargs = field.deconstruct()
self.assertEqual(kwargs, {'db_collation': 'utf8_esperanto_ci'})