localized_fields/value.py
def _interpret_value(self, value):
        """Interprets a value passed in the constructor as a
        :see:LocalizedValue.

        If string:
            Assumes it's the default language.

        If dict:
            Each key is a language and the value a string
            in that language.

        If list:
            Recurse into to apply rules above.

        Arguments:
            value:
                The value to interpret.
        """

        for lang_code, _ in settings.LANGUAGES:
            self.set(lang_code, self.default_value)

        if callable(value):
            value = value()

        if isinstance(value, str):
            self.set(settings.LANGUAGE_CODE, value)

        elif isinstance(value, dict):
            for lang_code, _ in settings.LANGUAGES:
                lang_value = value.get(lang_code, self.default_value)
                self.set(lang_code, lang_value)

        elif isinstance(value, Iterable):
            for val in value:
                self._interpret_value(val)
Interprets a value passed in the constructor as a
        :see:LocalizedValue.

        If string:
            Assumes it's the default language.

        If dict:
            Each key is a language and the value a string
            in that language.

        If list:
            Recurse into to apply rules above.

        Arguments:
            value:
                The value to interpret.
        
Interprets a value passed in the constructor as a
Interprets a value passed in the constructor as a
def _interpret_value(self, value):
        for lang_code, _ in settings.LANGUAGES:
            self.set(lang_code, self.default_value)
        if callable(value):
            value = value()
        if isinstance(value, str):
            self.set(settings.LANGUAGE_CODE, value)
        elif isinstance(value, dict):
            for lang_code, _ in settings.LANGUAGES:
                lang_value = value.get(lang_code, self.default_value)
                self.set(lang_code, lang_value)
        elif isinstance(value, Iterable):
            for val in value:
                self._interpret_value(val)
def _interpret_value ( self , value ) : for lang_code , _ in settings . LANGUAGES : self . set ( lang_code , self . default_value ) if callable ( value ) : value = value ( ) if isinstance ( value , str ) : self . set ( settings . LANGUAGE_CODE , value ) elif isinstance ( value , dict ) : for lang_code , _ in settings . LANGUAGES : lang_value = value . get ( lang_code , self . default_value ) self . set ( lang_code , lang_value ) elif isinstance ( value , Iterable ) : for val in value : self . _interpret_value ( val )
Interprets a value passed in the constructor as a
Interprets a value passed in the constructor as a
"""Interprets a value passed in the constructor as a
        :see:LocalizedValue.

        If string:
            Assumes it's the default language.

        If dict:
            Each key is a language and the value a string
            in that language.

        If list:
            Recurse into to apply rules above.

        Arguments:
            value:
                The value to interpret.
        """
self
value
see
LocalizedValue.
If string:
Assumes it's the default language.

If dict:
Each key is a language and the value a string
in that language.

If list:
Recurse into to apply rules above.

The value to interpret.
LocalizedValue . If string : Assumes it ' s the default language . If dict : Each key is a language and the value a string in that language . If list : Recurse into to apply rules above . The value to interpret .