mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #5641 -- Handle lazy translations correctly when used as default arguments. Thanks, permon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -152,7 +152,7 @@ TypeError: 'foo' is an invalid keyword argument for this function
|
||||
>>> a6 = Article(pub_date=datetime(2005, 7, 31))
|
||||
>>> a6.save()
|
||||
>>> a6.headline
|
||||
'Default headline'
|
||||
u'Default headline'
|
||||
|
||||
# For DateTimeFields, Django saves as much precision (in seconds) as you
|
||||
# give it.
|
||||
|
||||
@@ -42,7 +42,7 @@ __test__ = {'API_TESTS':"""
|
||||
|
||||
# Access database columns via Python attributes.
|
||||
>>> a.headline
|
||||
'Default headline'
|
||||
u'Default headline'
|
||||
|
||||
# make sure the two dates are sufficiently close
|
||||
>>> d = now - a.pub_date
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
class TestModel(models.Model):
|
||||
text = models.CharField(max_length=10, default=_('Anything'))
|
||||
|
||||
__test__ = {'API_TESTS': '''
|
||||
>>> tm = TestModel()
|
||||
>>> tm.save()
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user