question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Making existing fields translatable is not working with Django 2.1

See original GitHub issue

Django 2.1.12 django-parler 2.0

Prerequisites:

  1. Create a new project and app
  2. Add a new model( to follow the migration guide at https://django-parler.readthedocs.io/en/stable/advanced/migrating.html): class MyModel(models.Model): name = models.CharField(max_length=123)
  3. Create and run the migration with makemigration

Making existing fields translatable(like explained in the documentation https://django-parler.readthedocs.io/en/stable/advanced/migrating.html)

  1. Change the model to :
class MyModel(TranslatableModel):
    name = models.CharField(max_length=123)

    translations = TranslatedFields(
          name=models.CharField(max_length=123),
    )

  1. Create the migration with makemigration -> Error that the name field already exists( see https://github.com/django-parler/django-parler/issues/154 ) -> rename the TranslatedField to translations_t and create the migration
  2. Run the migration with migrate … -> AttributeError:

type object ‘MyModel’ has no attribute ‘_parler_meta’

Whatever you do, you always receive the attribute error that the model does not contain the parler_meta attribute. I need to make some fields translatable, that existed before, but unfortunately, I cannot make it work

Regards

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
pbeyelercommented, Sep 25, 2019

I am having the same issue with Django 1.11.20 and django-parler 2.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making existing fields translatable(Django) - Stack Overflow
I had the same issue. The fix for me was to prefix all fields in the original Model with an underscore, so... name...
Read more >
Making existing fields translatable - django-parler
The following guide explains how to make existing fields translatable, and migrate the data from the old fields to translated fields. django-parler stores ......
Read more >
Translation | Django documentation
In order to make a Django project translatable, you have to add a minimal number of hooks to your Python code and templates....
Read more >
django-parler Documentation - Read the Docs
Objects are not accidentally displayed in their fallback slugs, but redirect to the translated slug. 2.1.3 Making existing fields translatable.
Read more >
django-parler - PyPI
Using ModelAdmin.prepopulated_fields doesn't work, but you can use get_prepopulated_fields() as workaround. · Due to ORM restrictions queries for translated ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found