Beispiel #1
0
    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))
Beispiel #2
0
    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')
Beispiel #3
0
        ),
    }, )

Page.register_extensions(
    'feincms.extensions.ct_tracker',
    'feincms.extensions.seo',
    'feincms.module.page.extensions.titles',
    'feincms.module.page.extensions.navigationgroups',
    'feincms.extensions.translations',
)

# FeinCMS Contenttypes
# --------------------

Page.create_content_type(
    RichTextContent,
    cleanse=cleanse_html,
)
Page.create_content_type(
    FilerImageContent,
    TYPE_CHOICES=(('block', _('Full width')), ),
)
Page.create_content_type(FilerFileContent, )
Page.create_content_type(
    OembedContent,
    TYPE_CHOICES=[
        ('default', _('Default presentation'), {
            'maxwidth': 500,
            'maxheight': 300,
            'wmode': 'transparent'
        }),
    ],
Beispiel #4
0
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.application.models import ApplicationContent
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': 'base.html',
    'regions': (
        ('main', 'Main region'),
        ('sidebar', 'Sidebar', 'inherited'),
        ),
    })
Page.create_content_type(RawContent)
MediaFileContent.default_create_content_type(Page)
Page.create_content_type(ImageContent, POSITION_CHOICES=(
    ('default', 'Default position'),
    ))

def get_admin_fields(form, *args, **kwargs):
    return {
        'exclusive_subpages': forms.BooleanField(
            label=capfirst(_('exclusive subpages')),
            required=False,
            initial=form.instance.parameters.get('exclusive_subpages', False),
            help_text=_('Exclude everything other than the application\'s content when rendering subpages.'),
            ),
    }
Beispiel #5
0
        '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',
Beispiel #6
0
            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='******', 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'),
Beispiel #7
0
    {
        'key': '2col',
        'title': 'Two Column Template',
        'path': '2col.html',
        'regions': (
            ('main', _('Main region')),
            ('sidebar', _('Sidebar'), 'inherited'),
        )
    },
    {
        'key': 'blank',
        'title': 'Blank Template',
        'path': 'blank.html',
        'regions': (
            ('main', _('Main region')),
        )
    }
)
Page.create_content_type(RichTextContent)
Page.create_content_type(
    MediaFileContent,
    TYPE_CHOICES=(
        ('left', _('Float left')),
        ('right', _('Float right')),
        ('default', _('Default position')),
        ('sidebar', _('Sidebar')),
    )
)
Page.create_content_type(RawContent)
Page.create_content_type(ContactFormContent)
Page.create_content_type(VideoContent)
Beispiel #8
0
            ('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
Beispiel #9
0
)


Page.register_extensions(
    'feincms.module.extensions.ct_tracker',
    'feincms.module.page.extensions.navigation',
    'feincms.module.extensions.seo',
    'feincms.module.page.extensions.titles',
    'feincms.module.page.extensions.navigationgroups',
    ExcerptExtension
)

# FeinCMS Contenttypes
# --------------------

Page.create_content_type(
    RichTextContent, cleanse=cleanse_html)
Page.create_content_type(
    MediaFileContent,
    TYPE_CHOICES=(
        ('default', _('default')),
    ))
Page.create_content_type(
    OembedContent,
    TYPE_CHOICES=[
        ('default', _('Default presentation'), {
            'maxwidth': 500, 'maxheight': 300, 'wmode': 'transparent'}),
    ])

Page.create_content_type(
    FormContent)
# Page.create_content_type(
Beispiel #10
0
from feincms.module.page import processors

from mptt.models import MPTTModel

from .content import CustomContentType

Page.register_templates({
    'key': 'base',
    'title': 'Base Template',
    'path': 'base.html',
    'regions': (
        ('main', 'Main region'),
        ('sidebar', 'Sidebar', 'inherited'),
    ),
})
Page.create_content_type(RawContent)
Page.create_content_type(
    MediaFileContent,
    TYPE_CHOICES=(
        ('default', 'Default position'),
    )
)
Page.create_content_type(TemplateContent, TEMPLATES=[
    ('templatecontent_1.html', 'template 1'),
])
Page.register_request_processor(processors.etag_request_processor)
Page.register_response_processor(processors.etag_response_processor)
Page.register_response_processor(
    processors.debug_sql_queries_response_processor())

Beispiel #11
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)
Beispiel #12
0
from django.utils.translation import ugettext_lazy as _

from feincms.module.page.models import Page
from feincms_links.models import LinkContent

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (('main', _('Main content area')), )
})

PageLinkContent = Page.create_content_type(LinkContent)
Beispiel #13
0

class QuizAnswer(models.Model):
    feincms_item_editor_inline = FeinCMSInline
    answer = models.TextField(help_text='HTML is allowed.')
    correct = models.BooleanField(default=False)
    _l10n_fields = ['answer']

    class Meta:
        abstract = True

    def render(self, **kwargs):
        return render_to_string('includes/quizanswer.jinja', {'answer': self})


Page.create_content_type(RichTextEntry)
Page.create_content_type(ImageParagraphEntry)
Page.create_content_type(FAQEntry)
Page.create_content_type(YouTubeParagraphEntry)
Page.create_content_type(QuizQuestion)
Page.create_content_type(QuizAnswer)


@receiver(pre_save, dispatch_uid='trim_content_signal')
def trim_content(sender, instance, **kwargs):
    """Trim spaces from TextFields and CharFields before saving."""
    if sender in Page._feincms_content_types:
        for field in instance._meta.fields:
            if (isinstance(field, models.TextField)
                    or isinstance(field, models.CharField)):
                value = getattr(instance, field.name, '')
Beispiel #14
0
from zipfelchappe.models import Project

MEDIA_TYPE_CHOICES = (
    ('full', _('full')),
    ('left', _('left')),
    ('right', _('right')),
)

Page.register_templates({
    'title': _('Standard'),
    'path': 'base.html',
    'regions': (('main', _('Content')), ),
})

Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(('zipfelchappe.urls',
                                        _('Zipfelchappe projects')), ))

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)

Project.register_extensions('zipfelchappe.extensions.categories', )

Project.register_regions(
    ('main', 'Content'),
    ('thankyou', 'Thank you'),
)

Project.create_content_type(RichTextContent)
Project.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Beispiel #15
0
# Create your models here.

Page.register_extensions(
    'feincms.extensions.changedate', 'feincms.extensions.translations',
    'feincms.module.page.extensions.navigation',
    'feincms.module.page.extensions.navigationgroups',
    'feincms.extensions.seo',
    'feincms.module.page.extensions.titles')  # Example set of extensions

Page.register_templates({
    'title': _('Page'),
    'path': 'content/pages/page.html',
    'regions': (('main', _('Main content area')), ),
})

Page.register_templates({
    'title': _('Page Index'),
    'path': 'content/pages/page_index.html',
    'regions': (('main', _('Main content area')), ),
})

Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(('products.urls',
                                        'Product application'),
                                       ('cart.urls', 'Cart application'),
                                       ('sales.urls', 'Sales application')))

Page.create_content_type(ProductsNewCT)
Page.create_content_type(ProductsRelated)
Page.create_content_type(NewsBlock)
Beispiel #16
0
ExampleCMSBase2.register_regions(('region', 'region title'),
                                 ('region2', 'region2 title'))

Page.register_extensions(
    'feincms.module.extensions.datepublisher',
    'feincms.module.extensions.translations',
    'feincms.module.extensions.ct_tracker',
    'feincms.module.extensions.seo',
    'feincms.module.extensions.changedate',
    'feincms.module.extensions.seo',  # duplicate
    'feincms.module.page.extensions.navigation',
    'feincms.module.page.extensions.symlinks',
    'feincms.module.page.extensions.titles',
)
Page.create_content_type(ContactFormContent, form=ContactForm)
Page.create_content_type(FileContent)
Page.register_request_processor(processors.etag_request_processor)
Page.register_response_processor(processors.etag_response_processor)
Page.register_response_processor(
    processors.debug_sql_queries_response_processor())

Entry.register_extensions(
    'feincms.module.extensions.seo',
    'feincms.module.extensions.translations',
    'feincms.module.extensions.seo',
    'feincms.module.extensions.ct_tracker',
)


class BlogTestCase(TestCase):
Beispiel #17
0
    |_| \_\_|\___|_| |_| /_/   \_\__|_|\_\|_|_| |_|___/\___/|_| |_|

    Copyright 2011 ([email protected] / @tkinson)
"""
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.image.models import ImageContent

Page.register_extensions('datepublisher',
                         'translations')  # 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')),
                         ))
Beispiel #18
0
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.models import MediaFileContent

Page.register_extensions('feincms.module.page.extensions.navigation',
                         'feincms.module.page.extensions.titles',
                         'feincms.module.extensions.datepublisher',
                         'feincms.module.extensions.translations')

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(MediaFileContent,
                         TYPE_CHOICES=(
                             ('default', _('default')),
                             ('lightbox', _('lightbox')),
                         ))
Beispiel #19
0
    _('Map template'),
    'path':
    'map.html',
    'regions': (
        ('main', _('Main content area')),
        ('welcome', _('Welcome text')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('footer_main', _('Footer Main'), 'inherited'),
        ('footer_left', _('Footer Left'), 'inherited'),
        ('footer_right', _('Footer Right'), 'inherited'),
        ('footer_bottom', _('Footer Bottom'), 'inherited'),
    ),
})
Page.objects.exclude_from_copy.append('template_key')

Page.create_content_type(RichTextContent)

Page.create_content_type(CollapsibleSectionContent)
Page.create_content_type(PathwayListContent)
Page.create_content_type(RecentActivitiesContent)
Page.create_content_type(RssFeedContent)

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

Page.create_content_type(ExternallyLinkedMediaFileContent)
Page.create_content_type(MailchimpSignup)

Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(
                             ('livinglots_lots.map_urls', _('Lots map')),
Beispiel #20
0
# -*- coding:utf-8 -*-

from __future__ import absolute_import, unicode_literals

from feincms.module.page.models import Page
from feincms_oembed.contents import OembedContent

Page.register_templates({
    "key": "base",
    "title": "Base Template",
    "path": "base.html",
    "regions": [("main", "Main region")],
})
Page.create_content_type(OembedContent,
                         TYPE_CHOICES=[("default", "Default presentation", {})
                                       ])
Beispiel #21
0
        content += self.title2 + " " + self.point.replace('<li>', '').replace(
            '</li>', '')
        content = " ".join(findall(r'[\w ]+', content))
        for w in content.lower().split():
            find_pages = Search.objects.filter(word=w)
            if find_pages:
                find_pages[0].pages.add(Page.objects.get(id=self.parent_id))
                find_pages[0].save()
            else:
                s = Search(word=w)
                s.save()
                s.pages.add(Page.objects.get(id=self.parent_id))
                s.save()


Page.create_content_type(Single_column)


class Raiting(models.Model):
    class Meta:
        verbose_name = "Рейтинг"
        abstract = True

    def render(self):
        page = Page.objects.get(raiting_set=self.id)
        return render_to_string('widget/raiting/widgets-page1.html',
                                {'page_id': page.id})


Page.create_content_type(Raiting)
Page.register_templates({
    'title': _('Map template'),
    'path': 'map.html',
    'regions': (
        ('main', _('Main content area')),
        ('welcome', _('Welcome text')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('footer_main', _('Footer Main'), 'inherited'),
        ('footer_left', _('Footer Left'), 'inherited'),
        ('footer_right', _('Footer Right'), 'inherited'),
        ('footer_bottom', _('Footer Bottom'), 'inherited'),
    ),
})

Page.create_content_type(RichTextContent)

Page.create_content_type(CollapsibleSectionContent)
Page.create_content_type(PathwayListContent)
Page.create_content_type(RecentActivitiesContent)

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

Page.create_content_type(ExternallyLinkedMediaFileContent)
Page.create_content_type(MailchimpSignup)

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('livinglots_lots.map_urls', _('Lots map')),
    ('elephantblog.urls', _('Blog')),
Beispiel #23
0
Page.add_to_class("require_permission", models.BooleanField(_("require permission"), default=False))
Page.add_to_class("only_public", models.BooleanField(_("only public"), default=False))

# Content types
from feincms.utils import get_object
from django.template.loader import render_to_string

common_regions = ("main", "col1", "col2", "footer")

class AlbumContent(models.Model):
    album = models.ForeignKey(Album)
    class Meta:
        abstract = True
        verbose_name = _("album")
        verbose_name_plural = _('albums')
Page.create_content_type(AlbumContent, regions=("albums",))


class AddressRegisterContent(models.Model):
    class Meta:
        abstract = True
        verbose_name = _("address register")
        
    def render(self, **kwargs):
        ctx = dict(kamerers=User.objects.filter(is_active=True).order_by(
                                                        "instrument", 
                                                        "last_name", 
                                                        "first_name"))
        ctx.update(kwargs)
        return render_to_string("address_register.html", ctx)
    
Beispiel #24
0
    '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
    ('list-block', _('List Block')),
)


Page.register_templates(
    {
        'key': '1col',
        'title': 'Single column',
        'path': 'base.html',
        'regions': (
            ('main', _('Main content')),
            ('footer', _('Footer content')),
        ),
    },
    {
        'key': '2col',
        'title': 'Two columns',
        'path': 'page/2col.html',
        'regions': (
            ('main', _('Main content')),
            ('footer', _('Footer content')),
        ),
    },
)
Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=TYPE_CHOICES)
Page.create_content_type(SectionContent, TYPE_CHOICES=TYPE_CHOICES)
Page.register_extensions(
    'feincms.module.extensions.translations',
)
Beispiel #26
0
    {
    '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')),
    ))
Beispiel #27
0
from .content import CustomContentType

Page.register_templates({
    'key':
    'base',
    'title':
    'Base Template',
    'path':
    'base.html',
    'regions': (
        ('main', 'Main region'),
        ('sidebar', 'Sidebar', 'inherited'),
    ),
})
Page.create_content_type(RawContent)
Page.create_content_type(MediaFileContent,
                         TYPE_CHOICES=(('default', 'Default position'), ))
Page.create_content_type(TemplateContent,
                         TEMPLATES=[
                             ('templatecontent_1.html', 'template 1'),
                         ])
Page.register_request_processor(processors.etag_request_processor)
Page.register_response_processor(processors.etag_response_processor)
Page.register_response_processor(
    processors.debug_sql_queries_response_processor())


def get_admin_fields(form, *args, **kwargs):
    return {
        'exclusive_subpages':
Beispiel #28
0
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)
Beispiel #29
0
from feincms.module.page import processors

from mptt.models import MPTTModel

from .content import CustomContentType

Page.register_templates({
    "key":
    "base",
    "title":
    "Base Template",
    "path":
    "base.html",
    "regions": (("main", "Main region"), ("sidebar", "Sidebar", "inherited")),
})
Page.create_content_type(RawContent)
Page.create_content_type(MediaFileContent,
                         TYPE_CHOICES=(("default", "Default position"), ))
Page.create_content_type(TemplateContent,
                         TEMPLATES=[("templatecontent_1.html", "template 1")])
Page.register_request_processor(processors.etag_request_processor)
Page.register_response_processor(processors.etag_response_processor)
Page.register_response_processor(
    processors.debug_sql_queries_response_processor())


def get_admin_fields(form, *args, **kwargs):
    return {
        "exclusive_subpages":
        forms.BooleanField(
            label=capfirst(_("exclusive subpages")),
Beispiel #30
0
from django.utils.translation import ugettext_lazy as _

from feincms.content.richtext.models import RichTextContent
from feincms.module.page.models import Page

Page.register_extensions('pagepermissions.extension')

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (('main', _('Main content area')), ),
})

Page.create_content_type(RichTextContent)
Beispiel #31
0
    'map.html',
    'regions': (
        ('main', _('Main content area')),
        ('welcome', _('Welcome text')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('sidebar_left', _('Sidebar Left'), 'inherited'),
        ('footer_main', _('Footer Main'), 'inherited'),
        ('footer_column_left', _('Footer Left Column'), 'inherited'),
        ('footer_column_middle', _('Footer Middle Column'), 'inherited'),
        ('footer_column_right', _('Footer Right Column'), 'inherited'),
        ('footer_right', _('Footer Right'), 'inherited'),
        ('footer_bottom', _('Footer Bottom'), 'inherited'),
    ),
})

Page.create_content_type(RichTextContent)

Page.create_content_type(CollapsibleSectionContent)
Page.create_content_type(RecentActivitiesContent)

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

Page.create_content_type(ExternallyLinkedMediaFileContent)
Page.create_content_type(MailchimpSignup)
Page.create_content_type(BlogArchiveContent)
Page.create_content_type(RecentPostsContent)

Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(
                             ('faq.urls', _('FAQ')),
Beispiel #32
0
        return self.title


class Abstract(models.Model):
    content = MarkupMirrorField(
        markup_type=settings.MARKUPMIRROR_DEFAULT_MARKUP_TYPE)

    class Meta:
        abstract = True


class Concrete(Abstract):
    pass


class PostForm(forms.ModelForm):
    class Meta:
        model = Post
        exclude = ()


Page.register_templates({
    'key': 'page',
    'title': 'Page template',
    'path': 'feincms_page.html',
    'regions': (('main', 'Main region'), ),
})

# register *only* this contenttype
Page.create_content_type(MarkupMirrorContent)
Beispiel #33
0
from feincms.module.page.extensions.navigation import NavigationExtension, PagePretender
from feincms.content.application.models import reverse

from mptt.models import MPTTModel


Page.register_templates({
    'key': 'base',
    'title': 'Base Template',
    'path': 'base.html',
    'regions': (
        ('main', 'Main region'),
        ('sidebar', 'Sidebar', 'inherited'),
        ),
    })
Page.create_content_type(RawContent)
MediaFileContent.default_create_content_type(Page)
Page.create_content_type(ImageContent, POSITION_CHOICES=(
    ('default', 'Default position'),
    ))

def get_admin_fields(form, *args, **kwargs):
    return {
        'exclusive_subpages': forms.BooleanField(
            label=capfirst(_('exclusive subpages')),
            required=False,
            initial=form.instance.parameters.get('exclusive_subpages', False),
            help_text=_('Exclude everything other than the application\'s content when rendering subpages.'),
            ),
    }
Beispiel #34
0
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent

Page.register_templates(
    {
        'key': 'base',
        'title': _(u'Standard template'),
        'path': 'cms_base.html',
        'regions': (('main', _(u'Main content area')), ),
    }, )
Page.register_extensions(
    'feincms.module.extensions.changedate',
    'feincms.module.extensions.translations',
)

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')),
    ))

########NEW FILE########
__FILENAME__ = app
# use this as settings.py if you’re writing a reusable app and not a single project
# see http://djangopatterns.com/patterns/configuration/configure_app/
from django.conf import settings
Beispiel #35
0
Page.register_templates({
    'title': _('General FeinCMS Template Example'),
    'path': 'template1.html',
    'regions': (
        ('header', _('Page header.')),
        ('main', _('Main content area.')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('footer', _('Page footer.')),
    ),
})

GALLERY_TYPES = [
    specs.ClassicLightbox(),  # standard type
    specs.Type(
        verbose_name=_('Fancy paginated gallery'),
        paginated=True,
        paginate_by=12,
        orphans=4,
        template_name='slideshow.html',
        media={'css' : {'all' :
                    ('gallery/slideshow.css',
                     'lib/fancybox/jquery.fancybox-1.3.1.css'),},
                'js' :
                    ('gallery/slideshow.js',
                     'lib/fancybox/jquery.fancybox-1.3.1.pack.js')
        }
    )
]

Page.create_content_type(RichTextContent)
Page.create_content_type(GalleryContent, reqions=('main'),types=GALLERY_TYPES)
Beispiel #36
0
from readux.utils import solr_interface

# Page.register_extensions('datepublisher', 'translations') # Example set of extensions
# Page.register_extensions('changedate')  # in docs but not available

Page.register_templates({
    'title': _('Standard template'),
    'path': 'pages/base.html',
    'regions': (
        ('main', _('Main content area')),
        # ('sidebar', _('Sidebar'), 'inherited'),
        ('lead', _('Lead or tagline'), 'inherited'),
        ),
    })

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('lightbox', _('lightbox')),
    ('responsive_embed_4by3.html', _('responsive_embed_4by3.html')),
    ))

Page.create_content_type(VideoContent)


class RandomCollectionContent(models.Model):
    num_collections = models.IntegerField()

    class Meta:
        abstract = True
Beispiel #37
0
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',))
Beispiel #38
0
    link_text = models.CharField(max_length=50, blank=True)
    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',))
# 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',)
)
Beispiel #40
0
MEDIA_TYPE_CHOICES = (
    ('full', _('full')),
    ('left', _('left')),
    ('right', _('right')),
)

Page.register_templates({
    'title': _('Standard'),
    'path': 'base.html',
    'regions': (
        ('main', _('Content')),
    ),
})

Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('zipfelchappe.urls', _('Zipfelchappe projects')),
))

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)


Project.register_extensions(
    'zipfelchappe.extensions.categories',
)

Project.register_regions(
    ('main', 'Content'),
    ('thankyou', 'Thank you'),
)
Beispiel #41
0
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'),
    ),
)

Beispiel #42
0
        ),
        },{
        'title': _('Home Layout'),
        'path': 'home.html',
        'regions': (
            ('column1', _('Column 1')),
            ('column2', _('Column 2')),
            ('column3', _('Column 3')),
            ('column4', _('Column 4')),
            ('status1', _('Status 1')),
            ('status2', _('Status 2')),
        ),
        })


Page.create_content_type(RichTextContent)
Page.create_content_type(RawContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('plainImage', _('plainImage')),
    ))
Page.create_content_type(GalleryContent)


Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('bl_booking.urls', 'Schedule'),
    ('aurora.urls', 'Aurora Schedule'),
    ('news.urls', 'News'),
    ))

Page.create_content_type(newsList)


# 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)
Beispiel #44
0

Page.register_templates({
    'key': 'base',
    'title': _('Standard template'),
    'path': 'cms_base.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
    ),
})


Page.register_extensions(
    'feincms.module.extensions.changedate', # add creation and modification date to pages
    'feincms.module.extensions.datepublisher', # define when pages get visible
    'feincms.module.extensions.translations' # translations
) # Example set of extensions
# consider ct_tracker, if you use more than three content types


Page.create_content_type(RichTextContent)


Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('caption', _('with caption')),
    ('description', _('with description')),
    ('gallery', _('thumbnail opens gallery')),
))
Beispiel #45
0
        '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)
from django.utils.translation import ugettext_lazy as _

from feincms.content.richtext.models import RichTextContent
from feincms.module.page.models import Page


Page.register_extensions(
    'pagepermissions.extension'
)

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (
        ('main', _('Main content area')),
    ),
})

Page.create_content_type(RichTextContent)
Beispiel #47
0
                _('position'),
                max_length=10,
                choices=POSITION_CHOICES,
                default=POSITION_CHOICES[0][0]).contribute_to_class(
                    cls, 'position')

        if FORMAT_CHOICES:
            models.CharField(_('format'),
                             max_length=64,
                             choices=FORMAT_CHOICES,
                             default=FORMAT_CHOICES[0][0]).contribute_to_class(
                                 cls, 'format')


#Add content types
Page.create_content_type(RichTextContent)
Page.create_content_type(BiographyContent)
Page.create_content_type(CalendarContent)
Page.create_content_type(
    ImageContent,
    POSITION_CHOICES=(
        ('left', 'Float to left'),
        ('right', 'Float to right'),
        ('block', 'Block'),
    ),
)
Page.create_content_type(SubtitledHeader)
Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(
                             ('registration.urls', 'Registration application'),
                             ('compresults.urls',
Beispiel #48
0
from feincms.module.page.extensions.navigation import NavigationExtension, PagePretender
from feincms.content.application.models import reverse

from mptt.models import MPTTModel


Page.register_templates({
    'key': 'base',
    'title': 'Base Template',
    'path': 'base.html',
    'regions': (
        ('main', 'Main region'),
        ('sidebar', 'Sidebar', 'inherited'),
        ),
    })
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'),
    ))


def get_admin_fields(form, *args, **kwargs):
    return {
        'exclusive_subpages': forms.BooleanField(
            label=capfirst(_('exclusive subpages')),
            required=False,
            initial=form.instance.parameters.get('exclusive_subpages', False),
            help_text=_('Exclude everything other than the application\'s content when rendering subpages.'),
Beispiel #49
0
                                                       PagePretender)
from feincms.content.application.models import app_reverse

Page.register_templates({
    'key':
    'base',
    'title':
    'Base Template',
    'path':
    'base.html',
    'regions': (
        ('main', 'Main region'),
        ('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'), ),
)


def get_admin_fields(form, *args, **kwargs):
    return {
        'exclusive_subpages':
        forms.BooleanField(
Beispiel #50
0
    @classmethod
    def initialize_type(cls, POSITION_CHOICES=None, FORMAT_CHOICES=None):
        if POSITION_CHOICES:
            models.CharField(
                _('position'),
                max_length=10,
                choices=POSITION_CHOICES,
                default=POSITION_CHOICES[0][0]
                ).contribute_to_class(cls, 'position')

        if FORMAT_CHOICES:
            models.CharField(
                _('format'),
                max_length=64,
                choices=FORMAT_CHOICES,
                default=FORMAT_CHOICES[0][0]
                ).contribute_to_class(cls, 'format')
	
#Add content types
Page.create_content_type(RichTextContent)
Page.create_content_type(BiographyContent)
Page.create_content_type(CalendarContent)
Page.create_content_type(ImageContent, POSITION_CHOICES=(
        ('left', 'Float to left'),
        ('right', 'Float to right'),
        ('block', 'Block'),
    ),)
Page.create_content_type(SubtitledHeader)
Page.create_content_type(ApplicationContent, APPLICATIONS=(
    ('registration.urls', 'Registration application'),
    ))
Beispiel #51
0
from django.utils.translation import ugettext_lazy as _

from feincms.module.page.models import Page
from feincms.content.raw.models import RawContent
from feincms.content.richtext.models import RichTextContent
# Import the ``django-fobi`` widget.
from fobi.contrib.apps.feincms_integration.widgets import FobiFormWidget

Page.register_extensions('feincms.module.extensions.translations', )

# Register basic template.
Page.register_templates(
    {
        'title': _(u"Base template"),
        'path': 'page/base.html',
        'key': 'page_base',
        'regions': (
            ('main', _(u"Main")),
            ('sidebar', _(u"Sidebar")),
        )
    }, )

# Standard content types
Page.create_content_type(RawContent)
Page.create_content_type(RichTextContent)

# Register the ``django-fobi`` widget.
Page.create_content_type(FobiFormWidget)
Beispiel #52
0
            ('xccdc', _('Xia Chen CDC Users')),
            ('gscdc', _('Gong Shu CDC Users')),
            ('jgcdc', _('Jiang Gan CDC Users')),
            ('xhcdc', _('Xi Hu CDC Users')),
            ('xscdc', _('Xiao Shan CDC Users')),
            ('yhcdc', _('Yu Hang CDC Users')),
            ('fycdc', _('Fu Yang CDC Users')),
            ('cacdc', _('Chun An CDC Users')),
            ('jdcdc', _('Jian De CDC Users')),
            ('lacdc', _('Lin An CDC Users')),
            ('tlcdc', _('Tong Lu CDC Users')),
        ),
    },
)

Page.create_content_type(RichTextContent)
Page.create_content_type(FormContent)
Page.create_content_type(RawContent)
Page.create_content_type(FileContent)
#Page.register_request_processor(authenticated_request_processor)


Page.create_content_type(
    ApplicationContent,
    APPLICATIONS=(
        ('know.urls', 'Knowledge Application'),
        ('ask.urls', 'Ask Application'),
        ('article.urls', 'Article Application'),
        ('entrez.urls', 'Entrez Utils'),
        ('mlst.urls', 'MLST Application'),
    ),
Beispiel #53
0
        ),
    },
    {
        '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
Beispiel #54
0
#-*- 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

 # Set of extensions
Page.register_extensions('datepublisher',)

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (
            ('main', _('Main content area')),
        ),
    })

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
    ('default', _('default')),
    ('lightbox', _('lightbox')),
))
Beispiel #55
0
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)
Beispiel #56
0
            ('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(
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.contactform.models import ContactFormContent
from feincms.content.image.models import ImageContent

Page.register_extensions('datepublisher', 'translations') # Example set of extensions

Page.register_templates({
    'title': _('Standard template'),
    'path': 'page.html',
    'regions': (
        ('main', _('Main content area')),
        ('navbar', _('Navbar'), 'inherited'),
        ('sidebar', _('Sidebar'), 'inherited'),
        ),
    })

Page.create_content_type(RichTextContent, cleanse=True)
Page.create_content_type(ImageContent, POSITION_CHOICES=(
    ('block', _('block')),
    ('left', _('left')),
    ('right', _('right')),
    ))
Page.create_content_type(ContactFormContent, regions=('main',))
Beispiel #58
0
            ('main', _('Main content area')),
            ('sidebar', _('Sidebar'), 'inherited'),
            ('right', _('Right')),
        ),
    },
    {
        'key': 'app',
        'title': _('Forum Page'),
        'path': 'forum.html',
        'regions': (
            ('main', _('Main content area')),
        ),
    },
)

Page.create_content_type(RichTextContent)
Page.create_content_type(RawContent)
Page.create_content_type(FileContent)
Page.create_content_type(MarkupContent)
Page.create_content_type(HighCharts)
Page.create_content_type(GoogleMaps)
#Page.create_content_type(ContactForm)
#Page.create_content_type(RSSContent)
#Page.create_content_type(SectionContent)
Page.create_content_type(
    ImageContent,
    POSITION_CHOICES=(
        ('block', _('block')),
        ('left', _('left')),
        ('right', _('right')),
    )
Beispiel #59
0
})

Page.register_templates({
    'title':
    _('Home map template'),
    'path':
    'home_map.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('footer', _('Footer'), 'inherited'),
        ('welcome', _('Welcome message')),
    ),
})

Page.create_content_type(RichTextContent)

Page.create_content_type(CollapsibleSectionContent)
Page.create_content_type(MailingListSignup)
Page.create_content_type(PathwayListContent)
Page.create_content_type(RecentActivitiesContent)

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

Page.create_content_type(ApplicationContent,
                         APPLICATIONS=(
                             ('lots.map_urls', _('Lots map')),
                             ('elephantblog.urls', _('Blog')),
                             ('extraadmin.cms_urls',
                              _('Extra admin functions')),