Django-cms: Static placeholders don't track dirty status for each language

Created on 15 Nov 2016  路  5Comments  路  Source: django-cms/django-cms

If a user adds content to a static placeholder in multiple languages, publishing one of these languages will cause the dirty flag of the static placeholder to be set to False which results in unpublished content for the other languages once these are published.

bug accepted

Most helpful comment

We temporary uses this manage.py custom command. I will just leave it here:

from django.core.management.base import BaseCommand


class Command(BaseCommand):
    help = "Force publishing all StaticPlaceholders"

    def handle(self, *args, **options):
        self.stdout.write('publishing staticplaceholders')

        from cms.models import StaticPlaceholder
        from django.conf import settings

        for placeholder in StaticPlaceholder.objects.all():
            for lang in settings.LANGUAGES:
                placeholder.publish(None, lang[0], force=True)
        self.stdout.write('all done')

All 5 comments

If a static placeholder on a published page is stubbornly showing the content from a different language, then opening the placeholder and saving it again and publishing the page once more will reliably cause it to be published correctly.

Unfortunately this issue is diabolically hard to reproduce.

I was able to reproduce it on a local site with two languages. I was also able to work around it, as described above.

After adding a third language (and fourth), I was no longer able to reproduce the problem.

Worse, after returning to two languages, I was unable to reproduce it again.

On the other hand I have seen a user with an installation on which the workaround doesn't work.

Will continue investigating.

Any fix coming soon?

We temporary uses this manage.py custom command. I will just leave it here:

from django.core.management.base import BaseCommand


class Command(BaseCommand):
    help = "Force publishing all StaticPlaceholders"

    def handle(self, *args, **options):
        self.stdout.write('publishing staticplaceholders')

        from cms.models import StaticPlaceholder
        from django.conf import settings

        for placeholder in StaticPlaceholder.objects.all():
            for lang in settings.LANGUAGES:
                placeholder.publish(None, lang[0], force=True)
        self.stdout.write('all done')

Any news here? I recently faced the same problem. (django-cms==3.5.2, django==1.11.12)

Was this page helpful?
0 / 5 - 0 ratings