Django/Mezzanine Content Translation for Mezzanine Built-in Applications
By Güngör Budak
- One minute read - 94 wordsAs Mezzanine comes with additional Django applications such as pages, galleries and to translate their content, Mezzanine supports django-modeltranslation integration.
Install django-modeltranslation:
pip install django-modeltranslation
Add following to the INSTALLED_APPS
in settings.py
:
1"modeltranslation",
And following in settings.py
:
1USE_MODELTRANSLATION = True
Also, move mezzanine.pages to the top of other Mezzanine apps in INSTALLED_APPS
in settings.py
like so:
1"mezzanine.pages",
2"mezzanine.boot",
3"mezzanine.conf",
4"mezzanine.core",
5"mezzanine.generic",
6"mezzanine.blog",
7"mezzanine.forms",
8"mezzanine.galleries",
9"mezzanine.twitter",
10"mezzanine.accounts",
11"mezzanine.mobile",
Run following to create fields in database tables for translations:
python manage.py sync_translation_fieldspython manage.py update_translation_fields
Also, migrations might be needed:
python manage.py makemigrationspython manage.py migrate
And done.