5👍
✅
You can do this in the way the Parler documentation suggests throughout:
f = Federation()
f.set_current_language('en')
f.name = 'The British'
f.set_current_language('fr')
f.name = 'Les rosbifs'
f.save()
But you can also do:
f = Federation.objects.language('en').create(
name='The British',
)
f.set_current_language('fr')
f.name = 'Les rosbifs'
f.save()
which is what you’re asking about and is more elegant, especially if you only have one language version to create.
I discovered the language('en')
method here.
Source:stackexchange.com