#5641: ugettext_lazy in model's default
----------------------+-----------------------------------------------------
Reporter: permon | Owner: permon
Status: new | Component: Internationalization
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 1
----------------------+-----------------------------------------------------
Comment (by permon):
{{{
class TestModel(models.Model):
text = models.CharField(maxlength = 100, default =
ugettext_lazy('Anything'))
tm = TestModel()
tm.save()
}}}
Creating model is ok, but in tm.text is __proxy__ object and during
tm.save() it raises error. Type of error is dependent on db backend. With
MySQL it raises something like 'value too long, truncated', with sqlite3
(exactly this example)
{{{
InterfaceError: Error binding parameter 0 - probably unsupported type.
}}}
About force_unicode - it is also solution, I am attaching variant patch
--
Ticket URL: <http://code.djangoproject.com/ticket/5641#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---