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

ParentalManyToManyFields do not sync #820

Open
zemogle opened this issue Aug 28, 2024 · 2 comments
Open

ParentalManyToManyFields do not sync #820

zemogle opened this issue Aug 28, 2024 · 2 comments

Comments

@zemogle
Copy link

zemogle commented Aug 28, 2024

I have a model which includes references to several snippets. All of the snippets which is referenced by ForeignKey sync when translating the page. Any which are referenced by ParentalManyToManyField do not sync. e.g.

@register_snippet
class Age(TranslatableMixin):
    name = models.CharField(max_length=255)
    order = models.PositiveSmallIntegerField()
    def __str__(self):
        return self.name

    class Meta:
        unique_together = ('translation_key', 'locale')

@register_snippet
class Time(TranslatableMixin):
    name = models.CharField(max_length=255)
    order = models.PositiveSmallIntegerField()
    def __str__(self):
        return self.name

    class Meta:
        unique_together = ('translation_key', 'locale')

class Activity(Page):
    age = ParentalManyToManyField('activities.Age')
    time = models.ForeignKey(Time, on_delete=models.SET_NULL, blank=True, null=True)

The age values will appear as the English language version (i.e. the primary language) when the page has been translated.

The only way I can set the translations is to "stop synced translation", edit the affected fields, publish, then switch translation sync back on.

Wagtail = 5.2
Django = 4.1
Wagtail-localize = 1.9.2
Python = 3.8

@zerolab
Copy link
Collaborator

zerolab commented Dec 20, 2024

Possible duplicate of #534 (or at least it is related)

@erkandem
Copy link

To my understanding the issue of #534 is an sub-issue of this one.
Constraining the choices to the snippets of the correct locale relation seems to be the workaraound as described in the thread of #534.

However, what's unqiue about this issue here is that on the translated page, you don't have a widget to select values for the Age snippet at all.

I am facing the same issue in a client project.

And the workaround is the same for me as described by @zemogle:

  • stop synced translation
  • set desired values
  • hook back into the synced translation

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

No branches or pull requests

3 participants