Opened 4 years ago

Closed 4 years ago

#17858 closed Bug (worksforme)

ugettext_lazy problem in models and modelsforms

Reported by: javier@… Owned by: Javier
Component: Translations Version: 1.3
Severity: Normal Keywords: ugettext modelform forms
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


FIrst, sorry for my english, I'm Chilean.

I'm trying to use i18n but this don't works fine.

I made a model class

class Person(models.Model)
  name = models.CharField(_("name"), max_length=255)

and I use a modelForm

class PersonForm(ModelForm):
  class Meta:
    model = Person

when I show the PersonForm in a view this don't show anything, but if I use a {% trans "name" %} in a tempalte, this works fine.

In some part I saw "Lazy unexpected type" in wrapper I don't remember well.

This is curios, when I put #,fuzzy in a .po file, the form show the translate god but not the template.

I hope you can help me.

Change History (1)

comment:1 Changed 4 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

This works for me.

You need to make sure the Python process that is rendering your form has the language you expect the form labels displayed in activated. This can be achieved in different ways:

Last edited 4 years ago by ramiro (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top