本文整理匯總了Python中v1.models.browse_page.BrowsePage.header方法的典型用法代碼示例。如果您正苦於以下問題:Python BrowsePage.header方法的具體用法?Python BrowsePage.header怎麽用?Python BrowsePage.header使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類v1.models.browse_page.BrowsePage
的用法示例。
在下文中一共展示了BrowsePage.header方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_featured_content
# 需要導入模塊: from v1.models.browse_page import BrowsePage [as 別名]
# 或者: from v1.models.browse_page.BrowsePage import header [as 別名]
def test_featured_content(self):
"""Featured content value correctly displays on a Browse Page"""
bp = BrowsePage(
title='Browse Page',
slug='browse-page',
)
bp.header = StreamValue(bp.header.stream_block,
[
atomic.featured_content
], True)
bp.content = StreamValue(bp.content.stream_block,
[
atomic.expandable,
atomic.expandable_group
], True)
publish_page(child=bp)
response = django_client.get('/browse-page/')
self.assertContains(response, 'this is a featured content body')
示例2: run
# 需要導入模塊: from v1.models.browse_page import BrowsePage [as 別名]
# 或者: from v1.models.browse_page.BrowsePage import header [as 別名]
#.........這裏部分代碼省略.........
atomic.half_width_link_blob_group,
atomic.well
], True)
lap.sidefoot = StreamValue(lap.sidefoot.stream_block,
[
atomic.related_links,
atomic.sidebar_contact(contact.id)
], True)
publish_page(lap)
sp = SublandingPage.objects.filter(title='Sublanding Page')
if not sp:
sp = SublandingPage(title='Sublanding Page', slug='sublanding-page', owner=admin_user)
else:
sp = sp[0]
sp.content = StreamValue(sp.content.stream_block,
[
atomic.main_contact_info(contact.id),
atomic.reg_comment
], True)
sp.sidefoot = StreamValue(sp.sidefoot.stream_block,
[
atomic.email_signup,
atomic.rss_feed
], True)
publish_page(sp)
bp = BrowsePage.objects.filter(title='Browse Page')
if not bp:
bp = BrowsePage(title='Browse Page', slug='browse-page', owner=admin_user)
else:
bp = bp[0]
bp.header = StreamValue(bp.header.stream_block,
[
atomic.featured_content
], True)
bp.content = StreamValue(bp.content.stream_block,
[
atomic.expandable,
atomic.expandable_group
], True)
publish_page(bp)
# Filterable Pages
bfp = BrowseFilterablePage.objects.filter(title='Browse Filterable Page')
if not bfp:
bfp = BrowseFilterablePage(title='Browse Filterable Page', slug='browse-filterable-page', owner=admin_user)
else:
bfp = bfp[0]
bfp.header = StreamValue(bfp.header.stream_block, [atomic.text_introduction], True)
publish_page(bfp)
sfp = SublandingFilterablePage.objects.filter(title='Sublanding Filterable Page')
if not sfp:
sfp = SublandingFilterablePage(title='Sublanding Filterable Page', slug='sublanding-filterable-page',
owner=admin_user)
else:
sfp = sfp[0]
sfp.header = StreamValue(sfp.header.stream_block, [atomic.hero], True)
publish_page(sfp)
eap = EventArchivePage.objects.filter(title='Event Archive Page')
if not eap:
eap = EventArchivePage(title='Event Archive Page', slug='event-archive-page', owner=admin_user)
else: