'sync field that declared only in migrations with models.py file

I have model field that declared only in migration file, I need to declare it in models.py file, but when I'm trying to do that I'm getting this error:

ValueError: Error adding translation field. Model 'MyModel' already contains a field named 'name_en'.

update: field name_en field is modeltranslation field, is it possible to declare it in models.py?



Solution 1:[1]

Try by deleting the migration file and adding the field in models.py Then run your python manage.py makemigrations

Sometimes you need to delete your migrations files and also the database to avoid getting any errors

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ramy Berrekia