mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Fixed #28371 -- Fixed Cast() with CharField if the max_length argument isn't provided.
Thanks Tim Graham for the review.
This commit is contained in:
parent
14172cf442
commit
b61d5b1991
8 changed files with 25 additions and 0 deletions
|
@ -19,6 +19,10 @@ class CastTests(TestCase):
|
|||
numbers = Author.objects.annotate(cast_string=Cast('age', models.CharField(max_length=255)),)
|
||||
self.assertEqual(numbers.get().cast_string, '1')
|
||||
|
||||
def test_cast_to_char_field_without_max_length(self):
|
||||
numbers = Author.objects.annotate(cast_string=Cast('age', models.CharField()))
|
||||
self.assertEqual(numbers.get().cast_string, '1')
|
||||
|
||||
# Silence "Truncated incorrect CHAR(1) value: 'Bob'".
|
||||
@ignore_warnings(module='django.db.backends.mysql.base')
|
||||
@skipUnlessDBFeature('supports_cast_with_precision')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue