Commit f6d755d9 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch '149-multilingualfield-en-htmlfield-werken-niet-goed-samen' into 'master'

Revert "Fix translation.py error when saving"

This reverts commit d31edc44.

See the discussion in issue #149; this evaluated get_language
when the models were loaded rather than upon rendering the view

Closes #149 

This potentially breaks what was achieved in !126. I gave it a superficial glance and it looked like the migration still works, but perhaps this could do with some more thorough checking.

See merge request !170
parents 5a725fa7 d8aa6a2c
......@@ -50,10 +50,10 @@ class MultilingualField(object):
self.kwargs = kwargs
def _i18n_attr_accessor(attr, lang):
def _i18n_attr_accessor(attr):
def accessor(self):
return getattr(self, I18N_FIELD_FORMAT.format(attr, lang))
return getattr(self, I18N_FIELD_FORMAT.format(attr, get_language()))
return accessor
......@@ -95,7 +95,7 @@ class ModelTranslateMeta(models.base.ModelBase):
"by TranslateMeta.".format(attr_i18n))
dct[attr_i18n] = field.cls(*field.args, **field.kwargs)
fields.append(attr_i18n)
dct[attr] = property(_i18n_attr_accessor(attr, get_language()))
dct[attr] = property(_i18n_attr_accessor(attr))
default = I18N_FIELD_FORMAT.format(attr, settings.LANGUAGE_CODE)
if default not in dct:
raise ImproperlyConfigured("LANGUAGE_CODE not in LANGUAGES.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment