mirror of
				https://github.com/SectorLabs/django-localized-fields.git
				synced 2025-11-04 12:08:57 +03:00 
			
		
		
		
	String constructor for LocalizedValue
This allows you to do: LocalizedValue('thing'), which would result in a LocalizedValue looking
like this:
     {'en': 'thing', 'ar': None}
			
			
This commit is contained in:
		@@ -15,6 +15,9 @@ class LocalizedValue:
 | 
			
		||||
                different language.
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        if isinstance(keys, str):
 | 
			
		||||
            setattr(self, settings.LANGUAGE_CODE, keys)
 | 
			
		||||
        else:
 | 
			
		||||
            for lang_code, _ in settings.LANGUAGES:
 | 
			
		||||
                value = keys.get(lang_code) if keys else None
 | 
			
		||||
                setattr(self, lang_code, value)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user