Request Method: GET
Request URL: http://localhost:8000/blog/blog-title/
Django Version: 1.10.8
Exception Type: ValueError
Exception Value:
'title_en' is not in list
Exception Location: /lib/python3.6/site-packages/django/db/models/query.py in __init__, line 1715
Python Executable: /bin/python
Python Version: 3.6.5
after installing django-modeltranslation
i am getting this error on my django site.
I have tried adding fields in translationOptions. Also tried makemigration and migrations. This adds the title_en in table however it's not rendering the blog on the front.
Before adding django-modeltranslation
the blogs were being rendered properly without any error.
When you add
model-translation
to existing models, which already contain data, the data is still stored in the original column (e.g.title
) but not copied to the new default language columntitle_en
.So if you're migrating existing data, after
makemigrations
andmigrate
you should also runupdate_translation_fields
which will copy any existing values into the empty default language columns.You can run this multiple times (when adding translation to other models later), it only copies values when the
_en
field is empty.