Making existing fields translatable is not working with Django 2.1
See original GitHub issueDjango 2.1.12 django-parler 2.0
Prerequisites:
- Create a new project and app
- 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)
- 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)
- Change the model to :
class MyModel(TranslatableModel):
name = models.CharField(max_length=123)
translations = TranslatedFields(
name=models.CharField(max_length=123),
)
- 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
- 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:
- Created 4 years ago
- Reactions:1
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@floa93: See https://github.com/django-parler/django-parler/issues/157#issuecomment-534440366 for a workaround.
I am having the same issue with Django 1.11.20 and django-parler 2.0.