Ticket #91 (closed defect: fixed)
ugettext, ugettext_lazy or _ in model field
|Reported by:||vaneck.marcel@…||Owned by:||andrew|
|Keywords:||field description internationalization translation ugettext ugettext_lazy||Cc:|
As soon as someone uses internalization tools for Django. They may use ugettext, ugettext_lazy or a shortcut (like _).
The model field is defined as below:
foo = models.CharField?(_("Foo"), max_length=100)
This will give problems with South as the field in the migration file is defined as:
db.add_column('people_people', 'foo', models.CharField?(_("Foo"), max_length=100))
The function '_' is not defined for this field. In this particular situation it is easily fixed by added the proper include to the migration program (i.e. "from django.utils.translation import ugettext_lazy as _").
As the translation of the field description is irrelevant for South, I imagine two fixes for this issue:
- Strip out any functions surrounding the field description (is the field description necessary for the build anyways?).
- Auto include all the imports for the corresponding model file (seems like a nasty hack).
- Status changed from new to accepted
- Version set to subversion
- Milestone set to 0.5