On Tue, Mar 10, 2009 at 10:59 AM, Jana Álvarez Muñiz <jana.alva...@fundacionctic.org> wrote: > > 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):
You need to use ugettext_lazy() instead of ugettext(). > > 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")) > -- Ramiro Morales http://rmorales.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---