[Django]-Django-modelstranslation fallback original field value

1๐Ÿ‘

โœ…

  1. Clone the production database to a staging environment.
  2. Apply the migration in staging.
  3. Verify everything works in staging.

  4. Then either:

    a. Point the network configuration to staging, configure production at your leisure and reconfigure the network back (0 downtime).

    b. Update the production environment on live with the required packages and copy the database from staging environment into production (minimal downtime).

๐Ÿ‘คuser764357

4๐Ÿ‘

I was able to solve this without the need to clone the databases. What I did was:

  1. Deploy a version with the migration but without the actual django-modeltranslation changes.
  2. Run the migration. This will add several fields to the translated model but the code will still point to the original field.
  3. run the management command python manage.py update_translation_fields. This will clone the original field values to the default language field.
  4. Deploy a newer version of the code with the django-modeltranslation changes.
๐Ÿ‘คPepperoniPizza

Leave a comment