Skip to content

Changing Translation Fields

pwhipp edited this page Sep 5, 2014 · 1 revision

We are using django-modeltranslation to maintain the translation fields on the models and present them effectively both on the front end and in administration.

The range of languages is specified in settings.LANGUAGES.

If you change the languages setting or add a new translated model field, you need to use one or more of these commands. Do this locally!!:

  1. (staging)webcore:~/staging $ django sync_translation_fields

    This will add all new translation fields for the models and fields specified in the module translation.py files.

  2. (staging)webcore:~/staging $ django update_translation_fields

    This will migrate any existing default into the default language field. This has been done once, so unless you are planning on changing the default language and removing English, you probably will not need to worry about this one.

  3. (staging)webcore:~/staging $ django remove_unused_translation_fields

    This will remove fields that are no longer specified in settings.LANGUAGES.

  4. django schemamigration <app> --auto This will create a new migration that will add the new translation fields but these have already been added just to your local database so...

  5. django migrate <app> --fake This brings your local db/migration status into line

  6. On other databases you just need to apply the migration with django migrate.