From 0a8b911582eee85ea6da0d40dd2c7b12de5a78b2 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Thu, 11 Dec 2014 17:28:03 -0700 Subject: [1.7.x] Fixed #23455 -- Accept either bytes or text for related_name, convert to text. Backport of c72eb80d114fb5d90bd21b5549e8abd0bbd17f99 from master. --- tests/model_fields/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/model_fields/tests.py') diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 03aae7544c..53c3b301c7 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -181,6 +181,10 @@ class ForeignKeyTests(test.TestCase): fk_model_empty = FkToChar.objects.select_related('out').get(id=fk_model_empty.pk) self.assertEqual(fk_model_empty.out, char_model_empty) + def test_related_name_converted_to_text(self): + rel_name = Bar._meta.get_field_by_name('a')[0].rel.related_name + self.assertIsInstance(rel_name, six.text_type) + class DateTimeFieldTests(unittest.TestCase): def test_datetimefield_to_python_usecs(self): -- cgit v1.3