Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Add multi-languageBlockTranslatedContent in relation to Block #1227

Merged
merged 27 commits into from
Sep 4, 2024

Conversation

drikusroor
Copy link
Contributor

@drikusroor drikusroor commented Aug 21, 2024

This PR does the following:

  • It adds a BlockTranslatedContent model with an FK to Block
    • with the properties block, language, name, description
  • It adds a data migration that migrates the data currently in the Block (like name & description) to a BlockTranslatedContentwith the same language as the block (or defaults to English)
  • It that migration succeeded, it removes consent, hashtag, language and url from the `Block model.
  • I kept name and description for now as it might be convenient for the experiment administrator. They aren't used by anything afaik
  • I added a small javascript fix that makes sure tabular inline headings are displayed correctly as there currently is a bug in django-nested-admin whose fix is not yet released.

Video of experiment form

Screen.Recording.2024-08-30.at.12.29.26.mov

@drikusroor drikusroor self-assigned this Aug 21, 2024
@drikusroor drikusroor force-pushed the feat/1215-block-translated-content branch from 4a2ff99 to e64223c Compare August 22, 2024 13:58
@drikusroor drikusroor linked an issue Aug 22, 2024 that may be closed by this pull request
4 tasks
@drikusroor drikusroor marked this pull request as ready for review August 30, 2024 10:36
@@ -112,29 +117,31 @@ class Block(models.Model):
phase = models.ForeignKey(Phase, on_delete=models.CASCADE, related_name="blocks", blank=True, null=True)
index = models.IntegerField(default=0, help_text="Index of the block in the phase. Lower numbers come first.")
playlists = models.ManyToManyField("section.Playlist", blank=True)

# TODO: to be deleted?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this has been moved to BlockTranslatedContent, I think we can remove these, indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering though: What will be the name of a Block that has no Translated Content? How should we display it in the form/list?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, perhaps just the object name with id (which would be Django's default)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The __str__ method might also return something like Block with slug {slug} perhaps?

backend/experiment/rules/base.py Show resolved Hide resolved
backend/experiment/static/block_admin.js Outdated Show resolved Hide resolved
backend/experiment/tests/test_admin_experiment.py Outdated Show resolved Hide resolved
@drikusroor drikusroor merged commit 0204a9c into develop Sep 4, 2024
15 checks passed
@drikusroor drikusroor deleted the feat/1215-block-translated-content branch September 4, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate Block using a related "TranslatedContent" model
2 participants