本文整理汇总了Python中feincms.module.page.models.Page.create_content_type方法的典型用法代码示例。如果您正苦于以下问题:Python Page.create_content_type方法的具体用法?Python Page.create_content_type怎么用?Python Page.create_content_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feincms.module.page.models.Page
的用法示例。
在下文中一共展示了Page.create_content_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_14_richtext
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
def test_14_richtext(self):
# only create the content type to test the item editor
# customization hooks
tmp = Page._feincms_content_types[:]
type = Page.create_content_type(RichTextContent, regions=('notexists',))
Page._feincms_content_types = tmp
from django.utils.safestring import SafeData
obj = type()
obj.text = 'Something'
self.assertTrue(isinstance(obj.render(), SafeData))
示例2: test_18_default_render_method
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
def test_18_default_render_method(self):
"""
Test the default render() behavior of selecting render_<region> methods
to do the (not so) heavy lifting.
"""
class Something(models.Model):
class Meta:
abstract = True
def render_main(self):
return u'Hello'
# do not register this model in the internal FeinCMS bookkeeping structures
tmp = Page._feincms_content_types[:]
type = Page.create_content_type(Something, regions=('notexists',))
Page._feincms_content_types = tmp
s = type(region='main', ordering='1')
self.assertEqual(s.render(), 'Hello')
示例3:
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
from sandbox_feincms.page_extensions import page_as_model
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from django.db import models
Page.register_extensions(
'datepublisher',
'translations',
'changedate',
'navigation',
'symlinks',
'seo',
page_as_model,
)
Page.register_templates({
'key': 'content',
'title': 'Content Page',
'path': 'content.html',
'regions': (
('main', 'Main Region'),
),
})
Page.create_content_type(RichTextContent, regions=('main',))
示例4: render_region
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
def render_region(self):
return 'hello'
type = ExampleCMSBase.create_content_type(SomethingElse)
obj = type()
self.assertRaises(NotImplementedError, lambda: obj.render())
obj.region = 'region'
self.assertEqual(obj.render(), 'hello')
Page.register_extensions('datepublisher', 'navigation', 'seo', 'symlinks',
'titles', 'translations', 'seo', 'changedate')
Page.create_content_type(ContactFormContent, form=ContactForm)
Page.create_content_type(FileContent)
class PagesTestCase(TestCase):
def setUp(self):
u = User(username='test', is_active=True, is_staff=True, is_superuser=True)
u.set_password('test')
u.save()
Page.register_templates({
'key': 'base',
'title': 'Standard template',
'path': 'feincms_base.html',
'regions': (
('main', 'Main content area'),
示例5: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
{
'key' : 'base',
'title': _(u'Standard template'),
'path': 'cms_base.html',
'regions': (
('main', _(u'Main content area')),
),
},
)
Page.register_extensions('changedate', 'translations', )
#class ReSTContent(models.Model):
# content = models.TextField()
#
# class Meta:
# abstract = True
# verbose_name = _(u'ReStructured Text')
# verbose_name_plural = _(u'ReStructured Texts')
#
# def render(self, **kwargs):
# return restructuredtext(self.content)
#Page.create_content_type(ReSTContent)
Page.create_content_type(RichTextContent)
#MediaFileContent.default_create_content_type(Page)
Page.create_content_type(MediaFileContent, POSITION_CHOICES=(
#('left', _(u'left')),
('right', _(u'right')),
('center', _(u'center')),
))
示例6: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
'path': 'page_layout_templates/social_media.html',
'regions': (
('header_block', _('Header Block')),
('facebook', _('Facebook')),
('twitter', _('Twitter')),
('instagram', _('Instagram')),
('sponsors', _('Sponsors')),
)},
)
"""
Register content types for page creation interface
"""
if os.environ.get('CMS', False):
Page.create_content_type(MainSlider, regions=('main_slider',))
Page.create_content_type(GalleryContent, regions=(
'about',
'content',
'main_content',
'additional_content',)
)
Page.create_content_type(VideoContent, regions=(
'about',
'content',
'main_content',
'additional_content',
'video-column-1',
'video-column-2',
'video-column-3',
'medium-image-right-column',
示例7: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
'symlinks',
'titles',
'featured',
#'translations',
)
Page.register_templates({
'title': _('Standard template'),
'path': 'base.html',
'regions': (
('banner', _('banner ad'), 'inherited'),
('main', _('Main content area')),
('sidebar', _('Sidebar'), 'inherited'),
('footer', _('Footer'), 'inherited')
),
})
Page.create_content_type(RichTextContent)
Page.create_content_type(RawContent)
import datetime
from django.template.loader import render_to_string
from feincms.module.page.models import Page
from content.models import NewsArticle, Blog
two_weeks_ago = lambda: datetime.date.today() - datetime.timedelta(days=14)
class FrontPageNews(models.Model):
class Meta:
abstract = True
示例8: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
('left', _('Left Side'), 'inherited'),
),
},
{
'key': '3rd application',
'title': _('3rd Application'),
'path': 'site_application.html',
'regions': (
('application', _('Application')),
),
}
)
# Add rich content type
Page.create_content_type(RichTextContent)
# Add image content type
Page.create_content_type(
ImageContent,
POSITION_CHOICES=(
('block', _('block')),
('left', _('left')),
('right', _('right')),
)
)
# Add markup content type
#Page.create_content_type(MarkupContent)
# Add google maps content type
示例9: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
('col1', _('Main column')),
),
},
{
'key': 'two-cols',
'title': _('Two columns template'),
'path': 'two_columns_page.html',
'regions': (
('coll', _('Left column')),
('colr', _('Right column')),
),
},
)
Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
('default', _('default')),
))
Page.create_content_type(FormContent)
Page.create_content_type(ApplicationContent, APPLICATIONS=(
('elephantblog.urls', 'Blog'),
))
Entry.register_extensions(
'feincms.module.extensions.datepublisher',
)
Entry.register_regions(
示例10:
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
from feincms.module.page.models import Page
from form_designer.contents import FormContent
Page.register_templates(
{
"key": "base",
"title": "base",
"path": "base.html",
"regions": (("main", "main"),),
}
)
Page.create_content_type(FormContent)
示例11: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
),
},
{
'key': 'examples',
'title': _('Examples'),
'path': 'examples.html',
'regions': (
('main', _('Main content area')),
('left', _('Left Side'), 'inherited'),
),
},
)
# Add rich content type
Page.create_content_type(RichTextContent)
# Add image content type
#Page.create_content_type(
# ImageContent,
# POSITION_CHOICES=(
# ('block', _('block')),
# ('left', _('left')),
# ('right', _('right')),
# )
#)
# Add markup content type
#Page.create_content_type(MarkupContent)
# Add google maps content type
示例12: __import__
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
'regions': _basic_regions + _sidebar,
},
{
'key': 'twoCols',
'title': 'Two columns Template',
'path': 'twoCols.html',
'regions': _basic_regions + _twocols,
},
{
'key': 'twoColsSidebared',
'title': 'Two columns Template With Sidebar',
'path': 'twoColsSidebared.html',
'regions': _basic_regions + _twocols + _sidebar,
})
Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Page.create_content_type(VideoContent)
Page.create_content_type(RSSContent)
Page.create_content_type(ChildrenContent)
# import all gathered Page contents
for klassnames, modinfo in _contents.items():
package, mod = modinfo
_mod = __import__('%s.%s' % (mod, package), fromlist=[mod])
for klassname in klassnames:
klass = getattr(_mod, klassname)
Page.create_content_type(klass)
Page.create_content_type(FacebookSocialPluginContent)
示例13: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
# feincms page stuff
Page.register_extensions('datepublisher') # Example set of extensions
Page.register_templates({
'title': _('Standard template'),
'path': 'base.html',
'regions': (
('main', _('Main content area')),
('sidebar', _('Sidebar'), 'inherited'),
),
})
Page.create_content_type(RichTextContent)
Page.create_content_type(ImageContent, POSITION_CHOICES=(
('block', _('block')),
('left', _('left')),
('right', _('right')),
))
Page.create_content_type(app_models.ApplicationContent, APPLICATIONS=(
('website.entry_urls', 'News list'),
))
Page.create_content_type(TextilePageContent)
Page.create_content_type(SpheneWikiPageContent)
Page.create_content_type(SidebarLinksContent)
Page.create_content_type(YoutubeContent)
Page.create_content_type(MapContent)
示例14: import
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
from feincms.module.page.extensions.navigation import (
NavigationExtension, PagePretender)
from feincms.content.application.models import app_reverse
Page.register_templates({
'key': 'base',
'title': 'Base Template',
'path': 'index.html',
'regions': (
('main', 'Main region'),
('carousel','Carousel'),
('sidebar', 'Sidebar', 'inherited'),
),
})
Page.create_content_type(RichTextContent)
Page.create_content_type(RawContent)
Page.create_content_type(
MediaFileContent,
TYPE_CHOICES=(
('default', 'Default position'),
),
)
Page.create_content_type(
ImageContent,
POSITION_CHOICES=(
('default', 'Default position'),
),
)
示例15: _
# 需要导入模块: from feincms.module.page.models import Page [as 别名]
# 或者: from feincms.module.page.models.Page import create_content_type [as 别名]
# coding: utf-8
from django.utils.translation import ugettext_lazy as _
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.v2 import MediaFileContent
Page.register_extensions('translations', 'ct_tracker', 'navigation')
Page.register_templates({
'title': _('Standard template'),
'path': 'base.html',
'regions': (
('main', _('Main content area')),
('moodboard', _('Moodboard'), 'inherited'),
('sidebar', _('Sidebar'), 'inherited'),
),
})
Page.create_content_type(RichTextContent, regions=('main', 'sidebar'))
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
('full_width', _('full width')),
('left', _('left align')),
), regions=('main',)
)