-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: Add translated_content model and update Experiment model (#1208)
* feat: Add translated_content model with FK to experiment and add migrations * fix: Fix reverse migration * feat: Remove experiment fields and migrations The commit removes the `name`, `description`, `consent`, and `about_content` fields from the `Experiment` model and updates the admin forms accordingly. * refactor: Only show an empty form for a newly to be created experiment * feat: Add fallback option to get_translated_content method This commit adds a `fallback` parameter to the `get_translated_content` method in the `Experiment` model. When set to `True`, if no content is found for the specified language, it will return the primary content instead. If `fallback` is set to `False` and no content is found, a `ValueError` will be raised. Refactor the `get_content` method to `get_translated_content` to better reflect its purpose. * refactor: Rename primary_content to fallback_content * fix(test): Fix & update tests after adding experiment translated content * chore: Rename primary content to fallback content * refactor: Use `get_language` instead of checking `request.LANGUAGE_CODE` * refactor: Remove unnecessary code for setting language in get_block view as this has been replaced at the experiment level per #1204 * refactor: Moving setting the language cookie from `get_block` to `get_experiment` * test: Add tests for getting the right language content based on the `Accept-Language` header's value * refactor: Delete all experiment translated content This commit modifies the migration file `0050_migrate_experiment_content_to_translatedmakemigrations.py` to delete all experiment translated content using the `ExperimentTranslatedContent.objects.all().delete()` method. This change is necessary to clean up the database and ensure that no translated content exists anymore after running the reverse migration. * fix: Fix ci by changing `docker-compose` command to `docker compose`
- Loading branch information
1 parent
e2d3ef3
commit 577d107
Showing
25 changed files
with
1,195 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.