How to use the feincms3.templatetags.feincms3.translations function in feincms3

To help you get started, we’ve selected a few feincms3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / feincms3 / tests / testapp / test_feincms3.py View on Github external
slug="home-de",
            path="/de/",
            static_path=True,
            language_code="de",
            is_active=True,
            menu="main",
            translation_of=original,
        )

        self.assertEqual(set(original.translations()), {original, translation})
        self.assertEqual(set(translation.translations()), {original, translation})

        self.assertEqual(
            [
                language["object"]
                for language in translations(translation.translations())
            ],
            [original, translation, None],
        )

        original.delete()
        translation.refresh_from_db()

        self.assertEqual(set(translation.translations()), set())
github matthiask / feincms3 / tests / testapp / test_feincms3.py View on Github external
def test_translations_filter_edge_cases(self):
        self.assertEqual(len(translations(None)), 3)
        self.assertEqual(len(translations({})), 3)

        t = Template(
            "{% load feincms3 %}{% for l in c|translations %}{{ l.code }}{% endfor %}"
        )
        self.assertEqual(t.render(Context({"c": None})), "endefr")
        self.assertEqual(t.render(Context({"c": []})), "endefr")
        self.assertEqual(t.render(Context({"c": 1})), "endefr")
github matthiask / feincms3 / tests / testapp / test_feincms3.py View on Github external
def test_translations_filter_edge_cases(self):
        self.assertEqual(len(translations(None)), 3)
        self.assertEqual(len(translations({})), 3)

        t = Template(
            "{% load feincms3 %}{% for l in c|translations %}{{ l.code }}{% endfor %}"
        )
        self.assertEqual(t.render(Context({"c": None})), "endefr")
        self.assertEqual(t.render(Context({"c": []})), "endefr")
        self.assertEqual(t.render(Context({"c": 1})), "endefr")
github matthiask / feincms3 / tests / testapp / test_feincms3.py View on Github external
)
        Page.objects.create(
            title="home-de",
            slug="home-de",
            language_code="de",
            is_active=True,
            application="translated-articles",
        )

        original = TranslatedArticle.objects.create(title="News", language_code="en")
        translated = TranslatedArticle.objects.create(
            title="Neues", language_code="de", translation_of=original
        )

        self.assertEqual(
            [language["object"] for language in translations(original.translations())],
            [original, translated, None],
        )

        with override_urlconf(apps_urlconf()):
            self.assertEqual(
                original.get_absolute_url(), "/home-en/{}/".format(original.pk)
            )
            self.assertEqual(
                translated.get_absolute_url(), "/home-de/{}/".format(translated.pk)
            )