简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM