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

(Bug) bulk_create on TranslatableModel #334

Open
sam-val opened this issue Feb 16, 2023 · 1 comment
Open

(Bug) bulk_create on TranslatableModel #334

sam-val opened this issue Feb 16, 2023 · 1 comment

Comments

@sam-val
Copy link

sam-val commented Feb 16, 2023

Django version: 4.1.6
Parler version: 2.3

Say with this model:

class Language(TranslatableModel):
    class Meta:
        db_table = "language"

    translations = TranslatedFields(name=models.TextField())

I attempt to bulk_create:

>>> x = Language(name='english')
>>> y = Language(name='japanese')
>>> Language.objects.bulk_create([x, y])
# then....
>>> Language.objects.get(pk=x.id).name

it throws

parler.models.DoesNotExist: language does not have a translation for the current language!

(the name property somehow wasn't saved)

@sam-val sam-val changed the title (Bug) bulk_create on TranslatableModel (Bug) bulk_create on TranslatableModel Feb 16, 2023
@pablojimenezmateo
Copy link

Same here, whenever I save many objects using bulk_create the attributes are not saved. Right now saving them one by one fixes the issue, but does not seem to be ideal.

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