mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #10498 -- Fixed using ugettext_lazy values when creating model instances. Thanks to Claude Paroz and Jonas Obrist.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17641 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -5,6 +5,7 @@ from datetime import datetime
|
||||
|
||||
from django.core.exceptions import MultipleObjectsReturned
|
||||
from django.test import TestCase
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
from .models import Article, Reporter
|
||||
|
||||
@@ -412,3 +413,14 @@ class ManyToOneTests(TestCase):
|
||||
|
||||
# Same as each other
|
||||
self.assertTrue(r1.article_set.__class__ is r2.article_set.__class__)
|
||||
|
||||
def test_create_relation_with_ugettext_lazy(self):
|
||||
reporter = Reporter.objects.create(first_name='John',
|
||||
last_name='Smith',
|
||||
email='john.smith@example.com')
|
||||
lazy = ugettext_lazy(u'test')
|
||||
reporter.article_set.create(headline=lazy,
|
||||
pub_date=datetime(2011, 6, 10))
|
||||
notlazy = unicode(lazy)
|
||||
article = reporter.article_set.get()
|
||||
self.assertEqual(article.headline, notlazy)
|
||||
|
||||
Reference in New Issue
Block a user