diff --git a/django/db/models/base.py b/django/db/models/base.py
index ebd67be..edd7758 100644
a
|
b
|
from django.db.models.options import Options
|
20 | 20 | from django.db.models import signals |
21 | 21 | from django.db.models.loading import register_models, get_model |
22 | 22 | from django.utils.translation import ugettext_lazy as _ |
23 | | from django.utils.functional import curry |
| 23 | from django.utils.functional import curry, Promise |
24 | 24 | from django.utils.encoding import smart_str, force_unicode |
25 | 25 | from django.utils.text import get_text_list, capfirst |
26 | 26 | |
… |
… |
class Model(object):
|
298 | 298 | # is *not* consumed. We rely on this, so don't change the order |
299 | 299 | # without changing the logic. |
300 | 300 | for val, field in izip(args, fields_iter): |
| 301 | if isinstance(val, Promise): |
| 302 | val = force_unicode(val) |
301 | 303 | setattr(self, field.attname, val) |
302 | 304 | else: |
303 | 305 | # Slower, kwargs-ready version. |
304 | 306 | for val, field in izip(args, fields_iter): |
| 307 | if isinstance(val, Promise): |
| 308 | val = force_unicode(val) |
305 | 309 | setattr(self, field.attname, val) |
306 | 310 | kwargs.pop(field.name, None) |
307 | 311 | # Maintain compatibility with existing calls. |
… |
… |
class Model(object):
|
355 | 359 | # checked) by the RelatedObjectDescriptor. |
356 | 360 | setattr(self, field.name, rel_obj) |
357 | 361 | else: |
| 362 | if isinstance(val, Promise): |
| 363 | val = force_unicode(val) |
358 | 364 | setattr(self, field.attname, val) |
359 | 365 | |
360 | 366 | if kwargs: |
diff --git a/tests/modeltests/many_to_one/tests.py b/tests/modeltests/many_to_one/tests.py
index bc9fe64..d9d67bb 100644
a
|
b
|
from datetime import datetime
|
5 | 5 | |
6 | 6 | from django.core.exceptions import MultipleObjectsReturned |
7 | 7 | from django.test import TestCase |
| 8 | from django.utils.translation import ugettext_lazy |
8 | 9 | |
9 | 10 | from .models import Article, Reporter |
10 | 11 | |
… |
… |
class ManyToOneTests(TestCase):
|
412 | 413 | |
413 | 414 | # Same as each other |
414 | 415 | self.assertTrue(r1.article_set.__class__ is r2.article_set.__class__) |
| 416 | |
| 417 | def test_create_relation_with_ugettext_lazy(self): |
| 418 | reporter = Reporter.objects.create(first_name='John', |
| 419 | last_name='Smith', |
| 420 | email='john.smith@example.com') |
| 421 | lazy = ugettext_lazy(u'test') |
| 422 | reporter.article_set.create(headline=lazy, |
| 423 | pub_date=datetime(2011, 6, 10)) |
| 424 | notlazy = unicode(lazy) |
| 425 | article = reporter.article_set.get() |
| 426 | self.assertEqual(article.headline, notlazy) |