Translated models can't be used in datamigration
See original GitHub issueProbably similar to #100
When I try to use translated models in data migration I have an error when I try to create new instance and save it. The error is:
File "/path/to/virtualenv/lib/python3.4/site-packages/django/db/models/query.py", line 346, in create
obj = self.model(**kwargs)
File "/path/to/virtualenv/lib/python3.4/site-packages/parler/models.py", line 236, in __init__
for field in self._parler_meta.get_all_fields():
AttributeError: 'NoneType' object has no attribute 'get_all_fields'
Also when I try to query translated models with specific methods to parler’s TranslatableManager
it raises AttributeError
.
In the initial migration when model is created in migrations.CreateModel
step I see that bases are defined like that:
bases=(parler.models.TranslatableModelMixin, models.Model),
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Migrating from django-modeltranslation - Read the Docs
Run ./manage.py migrate to apply the generated data migrations. Your models with translated fields should have a populated i18n field after these migrations....
Read more >10 Considerations for Data Migrations and Translations
Are you faced with a complex data migration or translation? Do you have years of legacy data that needs to be migrated to...
Read more >Translating a Data Model - the SEI Online Help
In the Data Models and Views tab, right-click on a Data Model and select Translate Data Model. Example. Note. Languages available for translation...
Read more >The Difference Between Data Transformation and Data ... - Cleo
Translation can include data validation as well. One example of data translation is to convert EDI purchase order document data into purchase order...
Read more >Translate a multilingual model
Translating a model creates a secondary model of the language you choose. The secondary model contains the same content as the primary model....
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
same issue using django-parler==2.0 django==2.1.7
used
python manage.py makemigrations
when migrating from my old model:to new Model:
by manually changing the migration File from:
to
migrate is doing it’s job.
I’m working a solution which involves refactoring the base class. Can’t promise any ETA, though, but I’ll keep you updated