本文整理汇总了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])
示例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)
示例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')
示例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)
示例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")
示例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])