Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schematics.exceptions.ConversionError: [u'No default or explicit locales were given.'] #627

Open
phpsxg opened this issue Sep 2, 2021 · 1 comment

Comments

@phpsxg
Copy link

phpsxg commented Sep 2, 2021

from schematics.models import Model
from schematics.types import MultilingualStringType 

class TestModel(Model):
    mls = MultilingualStringType()

mls_test = TestModel({'mls': {
        'en_US': 'Hello, world!',
        'fr_FR': 'Bonjour tout le monde!',
        'es_MX': '¡Hola, mundo!', }})
print(mls_test.to_primitive(context={'locale': 'en_US'}))

error: schematics.exceptions.ConversionError: [u'No default or explicit locales were given.']

@lkraider
Copy link
Contributor

lkraider commented Sep 8, 2021

print(mls_test.to_primitive(context=Context(app_data={'locale': 'en_US'})))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants