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

dumpdata & loaddata manage.py command with django parler #327

Open
AlbertoSanmartinMartinez opened this issue Nov 18, 2022 · 1 comment
Open

Comments

@AlbertoSanmartinMartinez

Hi everybody

Is there any way to dump and load data with a TranslatableModel because with the common python manage.py dumpdata app.Organization -o fixtures/organizations.json Django command translated fields do not appear in the file.

models.py:

class Organization(TranslatableModel, Entity):
    translations = TranslatedFields(
        name = models.CharField(verbose_name=_("Name"), max_length=200),
        description = RichTextField(verbose_name=_("Description"), blank=True, null=True, config_name='default')
    )
    status = models.CharField(verbose_name=_("Status"), max_length=50),

organizations.json:

[
    {
        "model": "app.organization",
        "pk": 1,
        "fields": {
            "status": "Active"
        }
    },
    {
        "model": "app.organization",
        "pk": 2,
        "fields": {
            "status": "Active",
        }
    }
]

Any idea ?
Thanks in advanced.

@Pankrat
Copy link

Pankrat commented Nov 3, 2023

Just stumbled upon the same question. Adding <app>.<model>translation should work. In your example that would be:

python manage.py dumpdata app.organization app.organizationtranslation

Maybe this still helps somebody.

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