Hello!

I want to use translation in Django forms (and ModelForms), but the only 
solution I've found is using the 'label' attribute in the form fields
('from django.utils.translation import ugettext as _' is omitted):

forms.py:
class MyForm(ModelForm):
    name = forms.CharField(label=_('Name'))
    description = forms.CharField(label=_("Description"))
    class Meta:
        model  = models.MyModel
        fields = ('name', 'description')

models.py:
class MyModel (models.Model):
    name = models.CharField(max_length=50,verbose_name=_("Name"))
    description = models.CharField(max_length=200,              
verbose_name=_("Description"))

In ticket #3600 (http://code.djangoproject.com/ticket/3600) tells us that label 
only can be translated with 'gettext' during initialization, and this happens 
to me too.

Can somebody help me? I think must exist a way to translate fields form for a 
model...

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to