示例#1
0
Entry.register_extensions(
    'feincms.module.extensions.changedate',  # Creation and modification dates
    #'feincms.module.extensions.ct_tracker',            # Content type cache
    #'feincms.module.extensions.datepublisher',         # Date-based publishing
    #'feincms.module.extensions.featured',              # Simple featured flag for a page
    'feincms.module.extensions.seo',  # Search engine optimsation
    #'feincms.module.extensions.translations',          # Page translations
    'feincms.module.page.extensions.excerpt',  # Page summary
    #'feincms.module.page.extensions.navigation',       # Navigation extensions
    'feincms.module.page.extensions.relatedpages',  # Links related content
    #'feincms.module.page.extensions.sites',            # Limit pages to sites
    #'feincms.module.page.extensions.symlinks',         # Symlinked content extension
    #'feincms.module.page.extensions.titles',           # Additional titles
    'elephantblog.extensions.blogping',
)
Entry.register_regions(('main', 'Main content area'), )
Entry.create_content_type(RichTextContent)
Entry.create_content_type(RawContent)
Entry.create_content_type(MediaFileContent,
                          TYPE_CHOICES=(('default', 'default'), ))

#def highlight_pygments(page, request, response):
#    import pdb; pdb.set_trace()
#Entry.register_response_processor(highlight_pygments)

# Fake model generation
MIN_TITLE_LENGTH, MAX_TITLE_LENGTH = 10, 70
MIN_PARAGRAPHS, MAX_PARAGRAPHS = 1, 10
fake = Faker()

示例#2
0
# -*- coding:utf-8 -*-

from __future__ import absolute_import, unicode_literals

from elephantblog.models import Entry

try:
    from feincms.contents import RichTextContent
    from feincms.module.medialibrary.contents import MediaFileContent
except ImportError:  # FeinCMS<2
    from feincms.content.richtext.models import RichTextContent
    from feincms.content.medialibrary.models import MediaFileContent

Entry.register_regions(("main", "Main content area"), )

try:
    # FeinCMS 2.0
    import feincms.extensions.translations  # noqa
except ImportError:
    Entry.register_extensions("feincms.module.extensions.translations")
else:
    Entry.register_extensions("feincms.extensions.translations")

Entry.create_content_type(RichTextContent, cleanse=False, regions=("main", ))
Entry.create_content_type(MediaFileContent,
                          TYPE_CHOICES=(("default", "default"), ))
示例#3
0
    mediafile = MediaFileForeignKey(MediaFile, blank=True, null=True)

    class Meta:
        abstract = True
        verbose_name = "Article content"

    def render(self, **kwargs):
        return render_to_string([
            "content/article/%s.html" % self.region,
            "content/article/default.html",
            ], {'content': self})


Page.register_extensions('changedate', 'navigation', 'ct_tracker')
Page.create_content_type(RichTextContent, regions=('main', 'sidebar', 'moodboard'), cleanse=True)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Page.create_content_type(OembedContent, DIMENSION_CHOICES=DIMENSION_CHOICES, regions=('main',))
Page.create_content_type(FormContent)
Page.create_content_type(ArticleContent)

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('feincmsorg.app_library.urls', 'App Library'),
    ))

Entry.register_regions(
    ('main', _('Main content area')),
    )
Entry.create_content_type(RichTextContent, cleanse=True)
Entry.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Entry.create_content_type(OembedContent, DIMENSION_CHOICES=DIMENSION_CHOICES, regions=('main',))
示例#4
0
        verbose_name = _('recent posts')
        verbose_name_plural = _('recent posts')

    def render(self, **kwargs):
        return render_to_string([
            'elephantblog/recent_posts_plugin.html',
        ], {}, request=kwargs.get('request'))


Entry.register_extensions(
    'feincms.module.extensions.translations',
    'feincms.module.extensions.datepublisher',
)

Entry.register_regions(
    ('main', _('Main content area')),
    ('teaser', _('Blog entry teaser')),
)

Entry.create_content_type(
    RichTextContent,
    cleanse=feincms_cleanse.cleanse_html,
    regions=('main', 'teaser',)
)

Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
))


class BlogPost(Entry):
    class Meta:
from django.utils.translation import ugettext_lazy as _
from elephantblog.models import Entry
from importlib import import_module
from leonardo.module import media, web

from .widget.blogcategories.models import BlogCategoriesWidget
from .widget.recentblogposts.models import RecentBlogPostsWidget

Entry.register_extensions('leonardo.extensions.datepublisher',
                          'leonardo.extensions.translations',
                          )

REGIONS = ('preview', 'main',)

Entry.register_regions(
    ('preview', _('Preview content area')),
    ('main', _('Main content area')),
)


def get_class_from_string(widget):
    mod = '.'.join(widget.split('.')[0:-1])
    cls_name = widget.split('.')[-1]
    return getattr(import_module(mod), cls_name)

Entry.create_content_type(
    web.models.HtmlTextWidget, regions=REGIONS, optgroup=_('Text'))
Entry.create_content_type(
    web.models.MarkupTextWidget, regions=REGIONS, optgroup=_('Text'))

for widget in media.default.widgets:
    if isinstance(widget, six.string_types):
示例#6
0
from django.utils.translation import ugettext_lazy as _

from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
import feincms_cleanse

from elephantblog.models import Entry

Entry.register_extensions(
    'feincms.module.extensions.translations',
    'feincms.module.extensions.datepublisher',
)

Entry.register_regions(
    ('main', _('Main content area')),
    ('teaser', _('Blog entry teaser')),
)

Entry.create_content_type(RichTextContent,
                          cleanse=feincms_cleanse.cleanse_html,
                          regions=(
                              'main',
                              'teaser',
                          ))

Entry.create_content_type(MediaFileContent,
                          TYPE_CHOICES=(('default', _('default')), ))
示例#7
0
文件: models.py 项目: vencax/vxk-cms
    

Page.register_extensions('feincms.module.page.extensions.navigation')
Page.register_extensions('feincms.module.page.extensions.sites')
Page.register_extensions('feincms.module.extensions.seo')

# --------------------------------------------------------------
# ------------------------- BLOG -------------------------------
# --------------------------------------------------------------

if 'elephantblog' in settings.INSTALLED_APPS:
    from elephantblog.models import Entry as ElephantEntry
    from elephantblog.contents import QuoteContent
    
    ElephantEntry.register_regions(
        ('main', _('Main region')),
    )
    ElephantEntry.create_content_type(RichTextContent, cleanse=False, regions=('main',))
    ElephantEntry.create_content_type(CommentsContent)
    ElephantEntry.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
    
    ElephantEntry.create_content_type(VideoContent)
    ElephantEntry.create_content_type(GalleryContent)
    ElephantEntry.create_content_type(QuoteContent)
    
    ElephantEntry.register_extensions('feincms.module.extensions.seo')

# ------------------------- ORGEVENT -------------------------------

if 'groupagenda' in settings.INSTALLED_APPS:
    from groupagenda.models import Event
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms_oembed.contents import OembedContent

from elephantblog.models import Entry


Entry.register_extensions(
    'feincms.module.extensions.translations',
    'news.linkextension',
    'news.locationextension',
)

Entry.register_regions(
    ('main', _('Main content area')),
    ('preview', _('Preview')),
    ('cover', _('Cover image')),
)

Entry.create_content_type(RichTextContent,
    regions=('main', 'preview', 'cover',)
)

Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
))

Entry.create_content_type(OembedContent,
    TYPE_CHOICES=(
        ('default', _('Default'), { 'maxwidth': 500, 'maxheight': 300, 'wmode': 'opaque'}),
    ),
示例#9
0
# -*- coding:utf-8 -*-

from __future__ import absolute_import, unicode_literals

from elephantblog.models import Entry

try:
    from feincms.contents import RichTextContent, MediaFileContent
except ImportError:
    from feincms.content.richtext.models import RichTextContent
    from feincms.content.medialibrary.models import MediaFileContent


Entry.register_regions(("main", "Main content area"))

try:
    # FeinCMS 2.0
    import feincms.extensions.translations  # noqa
except ImportError:
    Entry.register_extensions("feincms.module.extensions.translations")
else:
    Entry.register_extensions("feincms.extensions.translations")

Entry.create_content_type(RichTextContent, cleanse=False, regions=("main",))
Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(("default", "default"),))
示例#10
0
from .widget.blogcategories.models import BlogCategoriesWidget
from .widget.recentblogposts.models import RecentBlogPostsWidget

Entry.register_extensions(
    'leonardo.extensions.datepublisher',
    'leonardo.extensions.translations',
)

REGIONS = (
    'preview',
    'main',
)

Entry.register_regions(
    ('preview', _('Preview content area')),
    ('main', _('Main content area')),
)


def get_class_from_string(widget):
    mod = '.'.join(widget.split('.')[0:-1])
    cls_name = widget.split('.')[-1]
    return getattr(import_module(mod), cls_name)


Entry.create_content_type(web.models.HtmlTextWidget,
                          regions=REGIONS,
                          optgroup=_('Text'))
Entry.create_content_type(web.models.MarkupTextWidget,
                          regions=REGIONS,
                          optgroup=_('Text'))
示例#11
0
文件: models.py 项目: ipsheeta/lbp
Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES = (('lightbox', 'Lightbox'),
                                                           ('block','Block Image')))
Page.create_content_type(ApplicationContent, APPLICATIONS= (
        ('elephantblog.urls', 'Blog'),
        ('pagemaker.forms_urls', 'Forms'),
    ))

### BLOG ENTRIES ###

Entry.register_extensions(#'feincms.module.extensions.datepublisher',
                          'elephantblog.extensions.blogping',
                          'elephantblog.extensions.tags',)
Entry.register_regions(
    ('main', _('Main content area')),
    ('featured', _('Featured Image')),
    ('teaser', _('Teaser')),
)
Entry.create_content_type(RichTextContent, cleanse=cleanse_html, regions=('main','teaser'))
Entry.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ))
Entry.create_content_type(VideoContent, regions=('main', 'teaser'))

### NEWSLETTERS ###

Newsletter.register_templates({
    'key': 'base',
    'title': 'Youth Seed Newsletter',
    'path': 'youthseed/ys-newsletter.html',
    'regions': (
示例#12
0
# extensions are declared in the reverse order that they appear in the admin
# NOTE: the 'seo' extension must be defined AFTER the 'translations' extension,
# otherwise it generates a django error
Entry.register_extensions(
    # 'feincms.extensions.featured',
    'feincms.module.extensions.changedate',
    # 'feincms.module.extensions.datepublisher',
    'feincms.module.extensions.translations',
    'feincms.module.page.extensions.excerpt',
    'feincms.module.extensions.seo',
    'feincms.module.page.extensions.titles',
    'elephantblog.extensions.blogping',
    'elephantblog.extensions.tags',
)
Entry.register_regions(
    ('main', _('Main region')),
)
Entry.create_content_type(
    RichTextContent,
    cleanse=feincms_cleanse.cleanse_html, 
    regions=('main',)
)
Entry.create_content_type(
    MediaFileContent, 
    TYPE_CHOICES=(
        ('left', _('Float left')),
        ('right', _('Float right')),
        ('default', _('Default position')),
    )
)
Entry.create_content_type(RawContent)