Exemplo n.º 1
0
    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'),
                    ('sidebar', 'Sidebar', 'inherited'),
                ),
            }, {
                'key':
                'theother',
                'title':
                'This actually exists',
                'path':
                'base.html',
                'regions': (
                    ('main', 'Main content area'),
                    ('sidebar', 'Sidebar', 'inherited'),
                ),
            })
def import_structure(f, root_id=None):
    """docstring for import_structure"""
    parents = {}
    if root_id:
        parents[0] = Page.objects.get(id=root_id)
    else:
        parents[0] = None
    kwargs = {
        'active': True,
        'in_navigation': True,
    }
    for line in f:
        match = re.match(r"^(#+) (\{[^)]*} )?(.*)$", unicode(line))
        if match:
            level = len(match.group(1))
            opts = match.group(2)
            if opts:
                js = json.loads(opts)
                kwargs.update(**dict([(str(k), v) for k, v in js.items()]))
            title = match.group(3)
            parent = parents[level-1]
            parent_page = Page.objects.get(pk=parent.pk) if parent else None
            p = Page(
                title=title,
                slug=slugify(title),
                parent=parent_page,
                **kwargs
            )
            p.save()
            parents[level] = p
            print('adding FeinCMS page: %s' % title)
def import_structure(f, root_id=None):
    """docstring for import_structure"""
    parents = {}
    if root_id:
        parents[0] = Page.objects.get(id=root_id)
    else:
        parents[0] = None

    for line in f:
        match = re.match(r"^(#+) (.*)$", line)
        if match:
            level = len(match.group(1))
            title = match.group(2)
            parent = parents[level - 1]
            parent_page = Page.objects.get(pk=parent.pk) if parent else None
            p = Page(active=True,
                     title=title,
                     slug=slugify(title),
                     in_navigation=True,
                     parent=parent_page)
            for field in ('navigation_type', ):
                if parent and parent.__dict__.get(field, None):
                    p.__dict__[field] = parent.__dict__[field]
            p.save()
            parents[level] = p
            print('adding FeinCMS page: %s' % title)
Exemplo n.º 4
0
    def setUp(self):
        Page.register_templates(
            {
                "key": "base",
                "title": "Standard template",
                "path": "feincms_base.html",
                "regions": (
                    ("main", "Main content area"),
                    ("sidebar", "Sidebar", "inherited"),
                ),
            }
        )
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language="en")
        de = self.create_default_page_set(language="de", title="Testseite")
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent

        if hasattr(translation, "LANGUAGE_SESSION_KEY"):
            self.language_session_key = translation.LANGUAGE_SESSION_KEY
        else:
            # Django 1.6
            self.language_session_key = django_settings.LANGUAGE_COOKIE_NAME
Exemplo n.º 5
0
    def setUp(self):
        Page.register_templates({
            'key':
            'base',
            'title':
            'Standard template',
            'path':
            'feincms_base.html',
            'regions': (
                ('main', 'Main content area'),
                ('sidebar', 'Sidebar', 'inherited'),
            ),
        })
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language='en')
        de = self.create_default_page_set(language='de', title='Testseite')
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent

        if hasattr(translation, 'LANGUAGE_SESSION_KEY'):
            self.language_session_key = translation.LANGUAGE_SESSION_KEY
        else:
            # Django 1.6
            self.language_session_key = django_settings.LANGUAGE_COOKIE_NAME
Exemplo n.º 6
0
    def setUp(self):
        Page.register_templates({
            'key': 'base',
            'title': 'Standard template',
            'path': 'feincms_base.html',
            'regions': (
                ('main', 'Main content area'),
                ('sidebar', 'Sidebar', 'inherited'),
            ),
        })
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language='en')
        de = self.create_default_page_set(language='de', title='Testseite')
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent

        if hasattr(translation, 'LANGUAGE_SESSION_KEY'):
            self.language_session_key = translation.LANGUAGE_SESSION_KEY
        else:
            # Django 1.6
            self.language_session_key = django_settings.LANGUAGE_COOKIE_NAME
Exemplo n.º 7
0
    def setUp(self):
        Page.register_templates({
            "key":
            "base",
            "title":
            "Standard template",
            "path":
            "feincms_base.html",
            "regions": (
                ("main", "Main content area"),
                ("sidebar", "Sidebar", "inherited"),
            ),
        })
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language="en")
        de = self.create_default_page_set(language="de", title="Testseite")
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent

        if hasattr(translation, "LANGUAGE_SESSION_KEY"):
            self.language_session_key = translation.LANGUAGE_SESSION_KEY
        else:
            # Django 1.6
            self.language_session_key = django_settings.LANGUAGE_COOKIE_NAME
Exemplo n.º 8
0
def test_copy_tree(mock_datetime, mock_page_objects,
                   mock_copy_content_and_children):
    mock_datetime.now().strftime.return_value = 'date'
    parent = Page()
    page = Page(title='foo bar', slug='sl-ug', active=True, parent=parent)
    assert (
        utils.copy_tree(page) == mock_copy_content_and_children.return_value)
    mock_page_objects.create.assert_called_with(
        title='Copy of foo bar on date',
        slug='copy-of-sl-ug-on-date',
        parent=parent,
        active=False)
    mock_copy_content_and_children.assert_called_with(
        page, mock_page_objects.create.return_value)
Exemplo n.º 9
0
    def ready(self):
        from feincms.module.blog.models import Entry
        from feincms.module.page.models import Page
        from feincms.content.raw.models import RawContent
        from feincms.content.image.models import ImageContent
        from feincms.content.medialibrary.models import MediaFileContent
        from feincms.content.application.models import ApplicationContent

        from .models import get_admin_fields

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

        Page.create_content_type(ApplicationContent,
                                 APPLICATIONS=(('blog_urls', 'Blog', {
                                     'admin_fields': get_admin_fields,
                                     'urls': 'example.blog_urls',
                                 }), ))

        Entry.register_regions(('main', 'Main region'), )
        Entry.create_content_type(RawContent)
        Entry.create_content_type(ImageContent,
                                  POSITION_CHOICES=(('default',
                                                     'Default position'), ))
Exemplo n.º 10
0
def test_pages_l10n_template():
    parent = Page(title="Parent Title", slug="parent-slug")
    page = Page(title="Page Title", slug="page-slug")
    page.parent = parent
    parent_entry = models.RichTextEntry(text="<p>Parent Text</p>")
    entry = models.RichTextEntry(text="<p>Page Text</p>")
    parent.content.all_of_type = lambda content_type: [parent_entry]
    page.content.all_of_type = lambda content_type: [entry]
    l10n_template = utils.pages_l10n_template([parent, page])
    assert "Page path: /parent-slug/\n" in l10n_template
    assert "Page path: /parent-slug/page-slug/\n" in l10n_template
    assert "{% blocktrans trimmed %}\nParent Title\n{% endblocktrans %}" in l10n_template
    assert "{% blocktrans trimmed %}\nPage Title\n{% endblocktrans %}" in l10n_template
    assert "{% blocktrans trimmed %}\n<p>Parent Text</p>\n{% endblocktrans %}" in l10n_template
    assert "{% blocktrans trimmed %}\n<p>Page Text</p>\n{% endblocktrans %}" in l10n_template
Exemplo n.º 11
0
def save_content(request):
    """
    content save handler
    Returns a HttpResponse whose content is JSON to tell if the operation succeeded.
    """
    result = {"result": False}

    if request.method == "POST":
        if request.POST["content"]:
            page_items = loads(request.POST["content"])

            for content_key, item in page_items.iteritems():
                # TODO: move to model/form cleaning

                content = item["value"]
                if settings.FEINCMS_TIDY_HTML:
                    content, errors, warnings = get_object(settings.FEINCMS_TIDY_FUNCTION)(content)

                matches = re.search("^page-page-richtextcontent-(\d+)-(\d+)$", content_key)
                if matches:
                    page_id, content_id = matches.group(1), matches.group(2)

                    # TODO: replace with more flexible solution (not tied to the RichTextContent model), as done in _frontend_editing_view
                    RTC = Page.content_type_for(RichTextContent)
                    rtc = RTC.objects.get(id=content_id, parent__id=page_id)
                    rtc.text = content

                    rtc.save()
                    # TODO: this should be done differently; being able to handle every page-item separartly (see formsets)
                    result = {"result": True}

    return HttpResponse(dumps(result), content_type="application/json")
Exemplo n.º 12
0
def test_pages_l10n_template():
    parent = Page(title='Parent Title', slug='parent-slug')
    page = Page(title='Page Title', slug='page-slug')
    page.parent = parent
    parent_entry = models.RichTextEntry(text='<p>Parent Text</p>')
    entry = models.RichTextEntry(text='<p>Page Text</p>')
    parent.content.all_of_type = lambda content_type: [parent_entry]
    page.content.all_of_type = lambda content_type: [entry]
    l10n_template = utils.pages_l10n_template([parent, page])
    assert 'Page path: /parent-slug/\n' in l10n_template
    assert 'Page path: /parent-slug/page-slug/\n' in l10n_template
    assert ('{% blocktrans trimmed %}\nParent Title\n{% endblocktrans %}'
            in l10n_template)
    assert ('{% blocktrans trimmed %}\nPage Title\n{% endblocktrans %}'
            in l10n_template)
    assert ('{% blocktrans trimmed %}\n<p>Parent Text</p>\n{% endblocktrans %}'
            in l10n_template)
    assert ('{% blocktrans trimmed %}\n<p>Page Text</p>\n{% endblocktrans %}'
            in l10n_template)
Exemplo n.º 13
0
    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"), ("sidebar", "Sidebar", "inherited")),
            },
            {
                "key": "theother",
                "title": "This actually exists",
                "path": "base.html",
                "regions": (("main", "Main content area"), ("sidebar", "Sidebar", "inherited")),
            },
        )
Exemplo n.º 14
0
def test_copy_page_with_parent(mock_page_objects,
                               mock_copy_content_and_children):
    page = Page(title='title', slug='slug', active=False)
    assert (utils.copy_page_with_parent(
        page, 'parent') == mock_copy_content_and_children.return_value)
    mock_page_objects.create.assert_called_with(title='title',
                                                slug='slug',
                                                parent='parent',
                                                active=False)
    mock_copy_content_and_children.assert_called_with(
        page, mock_page_objects.create.return_value)
Exemplo n.º 15
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))
Exemplo n.º 16
0
    def setUp(self):
        Page.register_templates({
            'key': 'base',
            'title': 'Standard template',
            'path': 'feincms_base.html',
            'regions': (
                ('main', 'Main content area'),
                ('sidebar', 'Sidebar', 'inherited'),
            ),
        })
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language='en')
        de = self.create_default_page_set(language='de', title=u'Testseite')
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent
Exemplo n.º 17
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))
Exemplo n.º 18
0
    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'),
                    ('sidebar', 'Sidebar', 'inherited'),
                    ),
                }, {
                'key': 'theother',
                'title': 'This actually exists',
                'path': 'base.html',
                'regions': (
                    ('main', 'Main content area'),
                    ('sidebar', 'Sidebar', 'inherited'),
                    ),
                })
Exemplo n.º 19
0
def import_structure(f, root_id=None):
    """docstring for import_structure"""
    parents = {}
    if root_id:
        parents[0] = Page.objects.get(id=root_id)
    else:
        parents[0] = None

    for line in f:
        match = re.match(r"^(#+) (.*)$", line)
        if match:
            level = len(match.group(1))
            title = match.group(2)
            parent = parents[level - 1]
            parent_page = Page.objects.get(pk=parent.pk) if parent else None
            p = Page(active=True, title=title, slug=slugify(title), in_navigation=True, parent=parent_page)
            for field in ("navigation_type",):
                if parent and parent.__dict__.get(field, None):
                    p.__dict__[field] = parent.__dict__[field]
            p.save()
            parents[level] = p
            print("adding FeinCMS page: %s" % title)
Exemplo n.º 20
0
def siblings_along_path_to(page_list, page2):
    """
    Filters a list of pages so that only those remain that are either:

        * An ancestor of the current page
        * A sibling of an ancestor of the current page

    A typical use case is building a navigation menu with the active
    path to the current page expanded::

        {% feincms_nav feincms_page level=1 depth=3 as navitems %}
        {% with navitems|siblings_along_path_to:feincms_page as navtree %}
            ... whatever ...
        {% endwith %}

    """

    if page_list:
        try:
            # Try to avoid hitting the database: If the current page is in_navigation,
            # then all relevant pages are already in the incoming list, no need to
            # fetch ancestors or children.

            # NOTE: This assumes that the input list actually is complete (ie. comes from
            # feincms_nav). We'll cope with the fall-out of that assumption
            # when it happens...
            ancestors = [
                a_page for a_page in page_list
                if _is_equal_or_parent_of(a_page, page2)
            ]
            top_level = min((a_page.level for a_page in page_list))

            if not ancestors:
                # Happens when we sit on a page outside the navigation tree
                # so fake an active root page to avoid a get_ancestors() db call
                # which would only give us a non-navigation root page anyway.
                p = Page(title="dummy",
                         tree_id=-1,
                         parent_id=None,
                         in_navigation=False)
                ancestors = (p, )

            siblings = [
                a_page for a_page in page_list
                if a_page.parent_id == page2.id or a_page.level == top_level
                or any((_is_sibling_of(a_page, a) for a in ancestors))
            ]
            return siblings
        except (AttributeError, ValueError), e:
            logger.warn("siblings_along_path_to caught exception: %s",
                        format_exception(e))
Exemplo n.º 21
0
class Company(MPTTModel):
    name = models.CharField(max_length=100, primary_key=True)
    iscompany = models.BooleanField(default=True)
    url = models.CharField(max_length=200, blank=True)
    parent = TreeForeignKey('self',
                            null=True,
                            blank=True,
                            related_name='children',
                            db_index=True,
                            on_delete=models.CASCADE)

    paper1 = models.CharField(max_length=150, blank=True)
    paper2 = models.CharField(max_length=150, blank=True)
    refer = models.CharField(max_length=150, blank=True)
    relation_level = models.CharField(max_length=50, blank=True)
    main_division = models.CharField(max_length=50, blank=True)
    sub_division = models.CharField(max_length=50, blank=True)

    class MPTTMeta:
        order_insertion_by = ['name']

    def __str__(self):
        return self.name

    #feinCMS-------------------------------------------------------------------------------------------------------------
    Page.register_extensions(
        'feincms.extensions.datepublisher',
        'feincms.extensions.translations')  # Example set of extensions
    Page.register_templates({
        'title':
        _('Standard template'),
        'path':
        'base.html',
        'regions': (
            ('main', _('Main content area')),
            ('sidebar', _('Sidebar'), 'inherited'),
        ),
    })
Exemplo n.º 22
0
class Vulner(MPTTModel):
    id = models.CharField(max_length=50, unique=True, primary_key=True)
    name = models.CharField(max_length=200)
    severity = models.CharField(max_length=20, null=True, blank=True)
    link = models.CharField(max_length=200, blank=True, null=True)
    parent = TreeForeignKey('self',
                            on_delete=models.CASCADE,
                            null=True,
                            blank=True,
                            related_name='children')

    class MPTTMeta:
        order_insertion_by = ['id']

    def __str__(self):
        return self.name

#feinCMS-------------------------------------------------------------------------------------------------------------

    Page.register_extensions(
        'feincms.extensions.datepublisher',
        'feincms.extensions.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(MediaFileContent,
                             TYPE_CHOICES=(
                                 ('default', _('default')),
                                 ('lightbox', _('lightbox')),
                             ))
Exemplo n.º 23
0
    def setUp(self):
        Page.register_templates({
            'key':
            'base',
            'title':
            'Standard template',
            'path':
            'feincms_base.html',
            'regions': (
                ('main', 'Main content area'),
                ('sidebar', 'Sidebar', 'inherited'),
            ),
        })
        self.site_1 = Site.objects.all()[0]

        # create a bunch of pages
        en = self.create_default_page_set(language='en')
        de = self.create_default_page_set(language='de', title='Testseite')
        de.translation_of = en
        de.save()
        de.parent.translation_of = en.parent
        de.parent.save()
        self.page_de = de.parent
        self.page_en = en.parent
Exemplo n.º 24
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')
Exemplo n.º 25
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')
Exemplo n.º 26
0
__author__ = 'alya'
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.extensions.datepublisher',
    'feincms.module.extensions.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(MediaFileContent,
                         TYPE_CHOICES=(
                             ('default', _('default')),
                             ('lightbox', _('lightbox')),
                         ))
Exemplo n.º 27
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')),
))
Exemplo n.º 28
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.template.loader import render_to_string
#from django.contrib.markup.templatetags.markup import restructuredtext
from feincms.module.page.models import Page
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('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):
Exemplo n.º 29
0
ExampleCMSBase.register_regions(('region', 'region title'), ('region2', 'region2 title'))


class ExampleCMSBase2(Base):
        pass

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())


class BlogTestCase(TestCase):
    def setUp(self):
        u = User(username='******', is_active=True, is_staff=True, is_superuser=True)
Exemplo n.º 30
0
from biographies.models import BiographySection

from mptt.fields import TreeForeignKey

from feincms.content.application.models import app_reverse

import uuid
import os

from django.core.exceptions import ImproperlyConfigured

from feincms import settings
from feincms.templatetags import feincms_thumbnail

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

Page.register_templates({
    'title': _('Standard template'),
    'path': 'basic.html',
    'regions': (
        ('main', _('Main content area')),
        ),
    })
			
class BiographyContent(models.Model):
	section = models.ForeignKey(BiographySection)
	
	class Meta:
		abstract = True
		
Exemplo n.º 31
0
from feincms.module.page.models import Page
from feincms.content.raw.models import RawContent
from feincms.content.image.models import ImageContent
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 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 {
Exemplo n.º 32
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)
Exemplo n.º 33
0
from feincms.content.video.models import VideoContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.application.models import ApplicationContent
from feincms.content.contactform.models import ContactFormContent
from feincms.module.page.extensions.navigation import NavigationExtension, PagePretender
from feincms.content.application.models import app_reverse


#
# Page
#
# extensions are declared in the reverse order that they appear in the admin
Page.register_extensions(
    'feincms.module.extensions.changedate',
    'feincms.module.extensions.translations',
    'feincms.module.page.extensions.navigation',
    'feincms.module.page.extensions.excerpt',
    'feincms.module.extensions.seo',
    'feincms.module.page.extensions.titles',
)
Page.register_templates(
    {
        'key': 'home',
        'title': 'Homepage Template',
        'path': 'home.html',
        'regions': (
            ('main', _('Main region')),
        )
    },
    {
        'key': '1col',
        'title': 'One Column Template',
Exemplo n.º 34
0
TYPE_CHOICES = (('block', 'Block'), )


class Dummy(create_base_model()):
    """A fake class for holding content"""


Dummy.register_regions(('body', 'Main'))
Dummy.create_content_type(TestContent)
Dummy.create_content_type(content_types.JsonRichTextContent)
Dummy.create_content_type(
    content_types.JsonMediaFileContent,
    TYPE_CHOICES=TYPE_CHOICES,
)
Dummy.create_content_type(
    content_types.JsonSectionContent,
    TYPE_CHOICES=TYPE_CHOICES,
)
Dummy.register_extensions(
    'feincms_extensions.render_regions',
    'feincms_extensions.render_json',
)

Page.register_templates({
    'key': 'key',
    'title': 'Title',
    'path': 'base.html',
    'regions': (('body', 'Main'), ),
})
Page.register_extensions('feincms_extensions.prepared_date', )
Exemplo n.º 35
0
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.application.models import ApplicationContent

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',
)
Exemplo n.º 36
0
from feincms.module.blog.models import Entry, EntryAdmin
from feincms.module.page.models import Page
from feincms.content.raw.models import RawContent
from feincms.content.image.models import ImageContent
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,
Exemplo n.º 37
0
from feincms.apps import ApplicationContent
from feincms.contents import RawContent, TemplateContent
from feincms.models import Base, create_base_model
from feincms.module.medialibrary.contents import MediaFileContent
from feincms.module.page.models import Page
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)
Exemplo n.º 38
0
MEDIA_TYPE_CHOICES = (
    ('default', _('default')),
)

DIMENSION_CHOICES = (
    ('590x432', _('default')),
)

Page.register_templates({
    'title': 'Standard template',
    'path': 'page_default.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('moodboard', _('Moodboard'), 'inherited'),
        ),
    },{
    'title': 'Homepage template',
    'path': 'page_home.html',
    'regions': (
        ('main', _('Main content area')),
        ('moodboard', _('Moodboard'), 'inherited'),
        ),
    })


class ArticleContentAdminForm(ItemEditorForm):
    def __init__(self, *args, **kwargs):
        super(ArticleContentAdminForm, self).__init__(*args, **kwargs)
        self.fields['text'].widget.attrs.update({'class': 'item-richtext'})

Exemplo n.º 39
0
# from django.db import models
from feincms.module.page.models import Page
from django.utils.translation import ugettext_lazy as _
from feincms.content.application.models import ApplicationContent
from .content_types import NewsIndexBlock, ServicesIndexBlock, ConceptIndexBlock, IndexMapBlock, ParthnersBlock, CustomersBlock, ReferencesBlock, ContactsBlock

# 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': _('Index Page'),
    'path': 'content/pages/index_page.html',
    'regions': (('main', _('Main content area')), ),
})

Page.create_content_type(NewsIndexBlock)
Page.create_content_type(ServicesIndexBlock)
Page.create_content_type(ConceptIndexBlock)
Page.create_content_type(IndexMapBlock)
Exemplo n.º 40
0
from feincms.module.medialibrary.models import MediaFile
from feincms.module.page.models import Page

from .forms import FeinCMSInline, MediaFileInline
from .utils import youtube_embed_url

jingo.env.install_gettext_translations(translation)

Page.register_templates(
    {
        'title':
        'Content template',
        'path':
        'content.html',
        'regions': (
            ('main', 'Main content area'),
            ('homepage', 'Homepage navigation'),
        ),
    }, {
        'title': 'Home template',
        'path': 'home.html',
        'regions': (('main', 'Main content area'), ),
    })


class YouTubeParagraphEntry(models.Model):
    feincms_item_editor_inline = FeinCMSInline
    title = models.CharField(max_length=255)
    subheader_2 = models.CharField(max_length=255, blank=True)
    subheader_3 = models.CharField(max_length=255, blank=True)
    text = models.TextField(help_text='HTML is allowed.')
Exemplo n.º 41
0
Article.create_content_type(RichTextContent)
Article.create_content_type(
    MediaFileContent,
    TYPE_CHOICES=(
        ('block', _('block')),
        ('left', _('left')),
    )
)

# Register page extensions
Page.register_extensions(
    'datepublisher',
    'translations',
    'changedate',
    'navigation',
    'seo',
    'symlinks',
    'titles',
    #'feincms_extension.page.auth',
)

# Register Templates used in pages
Page.register_templates(
    {
        'key': 'index',
        'title': _('Index Page'),
        'path': 'site_index.html',
        'regions': (
            ('main', _('Main content area')),
        ),
    },
Exemplo n.º 42
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)
Exemplo n.º 43
0
from feincms.content.richtext.models import RichTextContent
from feincms.content.image.models import ImageContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.application.models import ApplicationContent
from feincms.content.raw.models import RawContent
from feincms.content.rss.models import RSSContent
from feincms.content.comments.models import CommentsContent

#from IPython.Shell import IPShellEmbed
#ipython = IPShellEmbed()

Page.register_extensions(
    'changedate',
    'datepublisher',
    'navigation',
    'seo',
    '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)
Exemplo n.º 44
0
 def testPage(self):
     page = Page()
     self.assertTrue(hasattr(page, 'language'))
     self.assertTrue(hasattr(page, 'translation_of'))
     self.assertEqual(self.page_de.translation_of, self.page_en)
     self.assertEqual(self.page_de.original_translation, self.page_en)
Exemplo n.º 45
0
Page.register_templates(
    {
        'title': _('Topic Page'),
        'path': 'page_layout_templates/topic_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('rich_text_content', _('Rich Text Content')),
            ('featured', _('Featured')),
            ('icon-featured-panes', _('Icon Featured Panes')),
            ('main_content', _('Main Content')),
            ('parallax_box', _('Parallax Box')),
            ('additional_content', _('Additional Content')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Detail Page'),
        'path': 'page_layout_templates/detail_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('rich-text-left-column', _('Left Column Text Block')),
            ('medium-image-right-column', _('Right Column Image')),
            ('featured', _('Featured')),
            ('main_content', _('Main Content')),
            ('call_to_action', _('Parallax Box')),
            ('additional_content', _('Additional Content')),
            ('rich-text-left-column-2', _('Left Column Text Block 2')),
            ('medium-image-right-column-2', _('Right Column Image 2')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Home Page'),
        'path': 'page_layout_templates/home_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('main_slider', _('Main Slider')),
            ('call_to_action', _('Call To Action Bar')),
            ('featured', _('Featured')),
            ('rich-text-left-column', _('Left Column Text Block')),
            ('medium-image-right-column', _('Right Column Image')),
            ('parallax_box_1', _('Parallax Box 1')),
            ('about', _('About')),
            ('parallax_box_2', _('Parallax Box 2')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Two-Column Content Page'),
        'path': 'page_layout_templates/simple_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('content', _('Two-Column Content')),
            ('call_to_action', _('Call To Action Bar')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Flickr Gallery Page'),
        'path': 'page_layout_templates/flickr_gallery.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('rich_text_content', _('Rich Text Block')),
            ('flickr_gallery', _('Flickr Gallery')),
            ('videos', _('Youtube Videos')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Rich Text Page'),
        'path': 'page_layout_templates/plain_text_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('rich_text_content', _('Content')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Video Gallery Page'),
        'path': 'page_layout_templates/video_gallery.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('content', _('Content')),
            ('video-column-1', _('Video Column 1')),
            ('video-column-2', _('Video Column 2')),
            ('video-column-3', _('Video Column 3')),
            ('additional_content', _('Additional Content')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Pricing Table Page'),
        'path': 'page_layout_templates/pricing_page.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('title_banner', _('Title Banner')),
            ('rich_text_1', _('Rich Text Content 1')),
            ('pricing_table', _('Pricing Table')),
            ('rich_text_2', _('Rich Text Content 2')),
            ('sponsors', _('Sponsors')),
        )},
    {
        'title': _('Social Media Page'),
        'path': 'page_layout_templates/social_media.html',
        'regions': (
            ('header_block', _('Header Block')),
            ('facebook', _('Facebook')),
            ('twitter', _('Twitter')),
            ('instagram', _('Instagram')),
            ('sponsors', _('Sponsors')),
        )},
)
Exemplo n.º 46
0
from feincms.contents import RawContent, TemplateContent
from feincms.models import Base, create_base_model
from feincms.module.medialibrary.contents import MediaFileContent
from feincms.module.page.models import Page
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(
Exemplo n.º 47
0
from django.utils.translation import ugettext_lazy as _
from feincms.module.page.models import Page
from feincms.content.application.models import ApplicationContent
from feincms.content.richtext.models import RichTextContent
from feincms.content.raw.models import RawContent
from feincms.content.file.models import FileContent
from gform.content import FormContent
#from gbase.request_processors import authenticated_request_processor


# Register page extensions
Page.register_extensions(
    'feincms.module.extensions.datepublisher',
    'feincms.module.extensions.changedate',
    'feincms.module.page.extensions.navigation',
    'feincms.module.extensions.seo',
    'feincms.module.page.extensions.symlinks',
    'feincms.module.page.extensions.titles',
    'gbase.extensions.menu_class',
    #'feincms.module.page.extensions.translations',
)

# Loading templates for Page models
Page.register_templates(
    {
        'key': 'index',
        'title': _('Index Page'),
        'path': 'layout_index.html',
        'regions': (
            ('main', _('Main content area')),
        ),
    },
Exemplo n.º 48
0
from elephantblog.models import Entry
from feincms.module.page.models import Page
from feincms.content.application.models import ApplicationContent
from feincms.content.medialibrary.v2 import MediaFileContent
from feincms.content.raw.models import RawContent
from feincms.content.video.models import VideoContent
from form_designer.models import FormContent
from markupmirror.feincms.models import MarkupMirrorContent

Page.register_extensions('titles', 'seo')

Page.register_templates(
    {
        'title': 'Standard template',
        'path': 'base.html',
        'regions': (('main', 'Main content area'), ),
    }, {
        'title': 'Home page template',
        'path': 'home.html',
        'regions': (('main', 'Main content area'), ),
    }, {
        'title': 'Portfolio page template',
        'path': 'portfolio.html',
        'regions': (('main', 'Main content area'), ),
    }, {
        'title':
        'Contact page template',
        'path':
        'contact.html',
        'regions': (
            ('main', 'Main content area'),
Exemplo n.º 49
0
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
from elephantblog.models import Entry

#from feincms.content.application.models import retrieve_page_information
#Page.register_request_processor(retrieve_page_information)
#Writing.register_request_processor(retrieve_page_information)

# feinCMS core page type
Page.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
)
Page.register_templates(
    {
        'title': 'Standard page',
        'path': 'layouts/standard.html',
        'regions': (('main', 'Main content area'), ),
    }, {
        'title':
        'Front page',
        'path':
Exemplo n.º 50
0
    class Meta:
        abstract = True
        verbose_name = _('Mailchimp signup')
        verbose_name_plural = _('Mailchimp signup')

    def render(self, **kwargs):
        ctx = { 'signup': self }
        ctx.update(kwargs)
        return render_to_string([
            'content/mailchimp/signup.html',
        ], ctx, context_instance=kwargs.get('context'))


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

    'pagepermissions.extension',
)

Page.register_templates({
    'title': _('Standard template'),
    'path': 'base.html',
    'regions': (
        ('main', _('Main content area')),
        ('sidebar', _('Sidebar'), 'inherited'),
        ('footer_main', _('Footer Main'), 'inherited'),
        ('footer_left', _('Footer Left'), 'inherited'),
        ('footer_right', _('Footer Right'), 'inherited'),
        ('footer_bottom', _('Footer Bottom'), 'inherited'),
    ),
})
Exemplo n.º 51
0
from django.utils.translation import ugettext_lazy as _

from feincms.module.page.models import Page
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.richtext.models import RichTextContent
from feincms_oembed.contents import OembedContent

MEDIA_TYPE_CHOICES = (('default', _('Full width')), )

OEMBED_TYPE_CHOICES = (('default', _('Default'), {
    'maxwidth': 760,
    'maxheight': 480,
    'wmode': 'opaque'
}), )

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

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

Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Page.create_content_type(OembedContent, TYPE_CHOICES=OEMBED_TYPE_CHOICES)
Exemplo n.º 52
0
from __future__ import absolute_import, unicode_literals

from django.core.files import File as DjangoFile
from django.core.management.base import NoArgsCommand
from django.contrib.auth.models import User

from feincms.contents import FilerFileContent, FilerImageContent
from feincms.module.medialibrary.contents import MediaFileContent
from feincms.module.medialibrary.models import MediaFile
from feincms.module.page.models import Page

from filer.models import File, Image


PageMediaFileContent = Page.content_type_for(MediaFileContent)
PageFilerFileContent = Page.content_type_for(FilerFileContent)
PageFilerImageContent = Page.content_type_for(FilerImageContent)


assert all(
    (PageMediaFileContent, PageFilerFileContent, PageFilerImageContent)
), "Not all required models available"


class Command(NoArgsCommand):
    help = "Migrate the medialibrary and contents to django-filer"

    def handle_noargs(self, **options):
        user = User.objects.order_by("pk")[0]

        count = MediaFile.objects.count()
Exemplo n.º 53
0
            class Meta:
                abstract = True

            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': (
Exemplo n.º 54
0
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.content.video.models import VideoContent

from readux.books.models import Volume
from readux.collection.models import Collection, SolrCollection
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)

Exemplo n.º 55
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", {})
                                       ])
Exemplo n.º 56
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.template.loader import render_to_string
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from feincms.content.medialibrary.models import MediaFileContent


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)
Exemplo n.º 57
0
from feincms.content.raw.models import RawContent
from feincms.content.file.models import FileContent
#from feincms.content.contactform.models import ContactForm
#from feincms.content.rss.models import RSSContent
#from feincms.content.section.models import SectionContent
from content_ext.markup.models import MarkupContent
from content_ext.chart.models import HighCharts
from content_ext.googlemap.models import GoogleMaps


# Example set of extensions
Page.register_extensions(
    'datepublisher',
    'changedate',
    'translations',
    'navigation',
    'seo',
    'symlinks',
    'titles',
)

Page.register_templates(
    {
        'key': 'base',
        'title': _('Standard Template'),
        'path': 'base.html',
        'regions': (
            ('main', _('Main content area')),
            ('sidebar', _('Sidebar'), 'inherited'),
        ),
    },
Exemplo n.º 58
0
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from feincms.content.raw.models import RawContent
from feincms.content.medialibrary.models import MediaFileContent
from feincms.contrib import tagging
from gallery.models import GalleryContent
from news.models import news
from news.models import newsList

tagging.tag_model(Page)
#tagging.TagSelectField(Page)


Page.register_extensions(
    'feincms.module.extensions.datepublisher',   
    'feincms.module.extensions.seo', 
    'feincms.module.page.extensions.navigation',
    ) # Example set of extensions

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