POST per language breaks admin if translatable in __unicode__
xlotlu opened this issue · comments
Because of POST-ing once per language, after adding an item translatable fields will be None for the other languages.
This causes a "coercing to Unicode: need string or buffer, NoneType found" Exception if a translatable field is returned by Model.unicode().
I think adding translations one at a time is a bad design decision, because they should be enforced for all languages. Or ideally there should be a settings option that allows for missing translations.
UI-wise this could be done by preserving the initial multilingual approach with fieldsets, and they could be turned to tabs with a touch of javascript.
The tab based view has proven to be a lot more useful in all our projects than the 'all translations on one page' approach. Thus this feature will not be removed.
You should always check in your __unicode__
method if a certain translation exists. With the fallback languages properly set up it should work if at least one language is filled in. I suggest you do something like this:
def __unicode__(self) return unicode(self.title or self.pk)
Assuming title
is a field on your translation model