本文整理汇总了Python中cms.models.Placeholder.slot方法的典型用法代码示例。如果您正苦于以下问题:Python Placeholder.slot方法的具体用法?Python Placeholder.slot怎么用?Python Placeholder.slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cms.models.Placeholder
的用法示例。
在下文中一共展示了Placeholder.slot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_render_placeholder_toolbar
# 需要导入模块: from cms.models import Placeholder [as 别名]
# 或者: from cms.models.Placeholder import slot [as 别名]
def test_render_placeholder_toolbar(self):
placeholder = Placeholder()
placeholder.slot = "test"
placeholder.pk = placeholder.id = 99
context = SekizaiContext()
context["request"] = AttributeObject(
REQUEST={"language": "en"},
GET=[],
session={},
path="/",
user=self.test_user,
current_page=None,
method="GET",
)
classes = ["cms_placeholder-%s" % placeholder.pk, "cms_placeholder"]
output = render_placeholder_toolbar(placeholder, context, "test", "en")
for cls in classes:
self.assertTrue(cls in output, "%r is not in %r" % (cls, output))
示例2: test_render_placeholder_toolbar
# 需要导入模块: from cms.models import Placeholder [as 别名]
# 或者: from cms.models.Placeholder import slot [as 别名]
def test_render_placeholder_toolbar(self):
placeholder = Placeholder()
placeholder.slot = 'test'
placeholder.pk = placeholder.id = 99
request = self.get_request(page=None)
request.toolbar = CMSToolbar(request)
content_renderer = self.get_content_renderer(request)
context = SekizaiContext()
context['request'] = request
context['cms_content_renderer'] = content_renderer
classes = [
"cms-placeholder-%s" % placeholder.pk,
'cms-placeholder',
]
output = content_renderer.render_editable_placeholder(placeholder, context, 'en')
for cls in classes:
self.assertTrue(cls in output, '%r is not in %r' % (cls, output))
示例3: test_render_placeholder_toolbar
# 需要导入模块: from cms.models import Placeholder [as 别名]
# 或者: from cms.models.Placeholder import slot [as 别名]
def test_render_placeholder_toolbar(self):
placeholder = Placeholder()
placeholder.slot = 'test'
placeholder.pk = placeholder.id = 99
context = SekizaiContext()
context['request'] = AttributeObject(
REQUEST={'language': 'en'},
GET=[],
session={},
path='/',
user=self.test_user,
current_page=None,
method='GET',
)
classes = [
"cms_placeholder-%s" % placeholder.pk,
'cms_placeholder',
]
output = render_placeholder_toolbar(placeholder, context, 'test', 'en')
for cls in classes:
self.assertTrue(cls in output, '%r is not in %r' % (cls, output))