当前位置: 首页>>代码示例>>Python>>正文


Python placeholder.MLNGPlaceholderActions类代码示例

本文整理汇总了Python中cms.utils.placeholder.MLNGPlaceholderActions的典型用法代码示例。如果您正苦于以下问题:Python MLNGPlaceholderActions类的具体用法?Python MLNGPlaceholderActions怎么用?Python MLNGPlaceholderActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MLNGPlaceholderActions类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_mlng_placeholder_actions_get_copy_languages

 def test_mlng_placeholder_actions_get_copy_languages(self):
     actions = MLNGPlaceholderActions()
     fr = Translations.objects.get(language_code="fr")
     de = Translations.objects.get(language_code="de")
     en = Translations.objects.get(language_code="en")
     fieldname = "placeholder"
     fr_copy_languages = actions.get_copy_languages(fr.placeholder, Translations, fieldname)
     de_copy_languages = actions.get_copy_languages(de.placeholder, Translations, fieldname)
     en_copy_languages = actions.get_copy_languages(en.placeholder, Translations, fieldname)
     EN = ("en", "English")
     FR = ("fr", "French")
     self.assertEqual(fr_copy_languages, [EN])
     self.assertEqual(de_copy_languages, [EN, FR])
     self.assertEqual(en_copy_languages, [FR])
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:14,代码来源:placeholder.py

示例2: test_mlng_placeholder_actions_empty_copy

    def test_mlng_placeholder_actions_empty_copy(self):
        actions = MLNGPlaceholderActions()
        fr = Translations.objects.get(language_code='fr')
        de = Translations.objects.get(language_code='de')
        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        new_plugins = actions.copy(fr.placeholder, 'de', 'placeholder', Translations, 'fr')
        self.assertEqual(len(new_plugins), 0)

        de = self.reload(de)
        fr = self.reload(fr)

        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)
开发者ID:124bit,项目名称:django_ukrhim,代码行数:15,代码来源:placeholder.py

示例3: test_05_mlng_placeholder_actions_no_placeholder

 def test_05_mlng_placeholder_actions_no_placeholder(self):
     actions = MLNGPlaceholderActions()
     nl = Translations.objects.get(language_code='nl')
     de = Translations.objects.get(language_code='de')
     self.assertEqual(nl.placeholder, None)
     self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)
     
     okay = actions.copy(de.placeholder, 'nl', 'placeholder', Translations, 'de')
     self.assertEqual(okay, False)
     
     de = self.reload(de)
     nl = self.reload(nl)
     
     nl = Translations.objects.get(language_code='nl')
     de = Translations.objects.get(language_code='de')
开发者ID:AdrianRibao,项目名称:django-cms,代码行数:15,代码来源:placeholder.py

示例4: test_mlng_placeholder_actions_copy

    def test_mlng_placeholder_actions_copy(self):
        actions = MLNGPlaceholderActions()
        fr = Translations.objects.get(language_code="fr")
        de = Translations.objects.get(language_code="de")
        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        new_plugins = actions.copy(de.placeholder, "fr", "placeholder", Translations, "de")
        self.assertEqual(len(new_plugins), 1)

        de = self.reload(de)
        fr = self.reload(fr)

        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 1)
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:15,代码来源:placeholder.py

示例5: test_mlng_placeholder_actions_no_placeholder

    def test_mlng_placeholder_actions_no_placeholder(self):
        actions = MLNGPlaceholderActions()
        Translations.objects.filter(language_code="nl").update(placeholder=None)
        de = Translations.objects.get(language_code="de")
        nl = Translations.objects.get(language_code="nl")
        self.assertEqual(nl.placeholder, None)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        okay = actions.copy(de.placeholder, "nl", "placeholder", Translations, "de")
        self.assertEqual(okay, False)

        de = self.reload(de)
        nl = self.reload(nl)

        nl = Translations.objects.get(language_code="nl")
        de = Translations.objects.get(language_code="de")
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:16,代码来源:placeholder.py

示例6: test_mlng_placeholder_actions_get_copy_languages

 def test_mlng_placeholder_actions_get_copy_languages(self):
     actions = MLNGPlaceholderActions()
     fr = Translations.objects.get(language_code='fr')
     de = Translations.objects.get(language_code='de')
     en = Translations.objects.get(language_code='en')
     fieldname = 'placeholder'
     fr_copy_languages = actions.get_copy_languages(
         fr.placeholder, Translations, fieldname
     )
     de_copy_languages = actions.get_copy_languages(
         de.placeholder, Translations, fieldname
     )
     en_copy_languages = actions.get_copy_languages(
         en.placeholder, Translations, fieldname
     )
     EN = ('en', 'English')
     FR = ('fr', 'French')
     self.assertEqual(fr_copy_languages, [EN])
     self.assertEqual(de_copy_languages, [EN, FR])
     self.assertEqual(en_copy_languages, [FR])
开发者ID:124bit,项目名称:django_ukrhim,代码行数:20,代码来源:placeholder.py


注:本文中的cms.utils.placeholder.MLNGPlaceholderActions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。