How to use the feincms.content.richtext.models.RichTextContent function in FeinCMS

To help you get started, we’ve selected a few FeinCMS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / django-content-editor / feincms / tests.py View on Github external
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'
        assert isinstance(obj.render(), SafeData)
github matthiask / django-content-editor / feincms / tests.py View on Github external
def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(FileContent), None)

        ExampleCMSBase.create_content_type(ContactFormContent)
        ExampleCMSBase.create_content_type(FileContent, regions=('region2',))

        # no POSITION_CHOICES, should raise
        self.assertRaises(ImproperlyConfigured,
                          lambda: ExampleCMSBase.create_content_type(ImageContent))

        ExampleCMSBase.create_content_type(RawContent)
        ExampleCMSBase.create_content_type(RichTextContent)

        # test creating a cotent with arguments, but no initialize_type classmethod
        ExampleCMSBase.create_content_type(VideoContent, arbitrary_arg='arbitrary_value')

        # content_type_for should return None if it does not have a subclass registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        assert 'filecontent' not in dict(ExampleCMSBase.template.regions[0].content_types).values()
        assert 'filecontent' in dict(ExampleCMSBase.template.regions[1].content_types).values()
github feincms / feincms / feincms / tests.py View on Github external
def test_01_simple_content_type_creation(self):
        self.assertEqual(ExampleCMSBase.content_type_for(FileContent), None)

        ExampleCMSBase.create_content_type(ContactFormContent)
        ExampleCMSBase.create_content_type(FileContent, regions=('region2',))

        # no POSITION_CHOICES, should raise
        self.assertRaises(ImproperlyConfigured,
                          lambda: ExampleCMSBase.create_content_type(ImageContent))

        ExampleCMSBase.create_content_type(RawContent)
        ExampleCMSBase.create_content_type(RichTextContent)

        # test creating a cotent with arguments, but no initialize_type classmethod
        ExampleCMSBase.create_content_type(VideoContent, arbitrary_arg='arbitrary_value')

        # content_type_for should return None if it does not have a subclass registered
        self.assertEqual(ExampleCMSBase.content_type_for(Empty), None)

        assert 'filecontent' not in dict(ExampleCMSBase.template.regions[0].content_types).values()
        assert 'filecontent' in dict(ExampleCMSBase.template.regions[1].content_types).values()
github django-leonardo / django-leonardo / hrcms / conf / feincms.py View on Github external
'key': 'dashboard',
        'path': 'layout/dashboard.html',
        'regions': PAGE_REGIONS,
    },
    {
        'title': _('API'),
        'key': 'api',
        'path': 'rest_framework/api.html',
        'regions': PAGE_REGIONS,
    },
)


Page.register_templates(*PAGE_TEMPLATES)

Page.create_content_type(RichTextContent)

APPLICATION_CHOICES = (
    #    ('webcms.module.web.apps.auth', _('User authentication')),
    #
    #    ('webcms.module.nav.apps.fulltext', _('Fulltext search')),
    #    ('webcms.module.nav.apps.googlesearch', _('Google search')),
    #
    #    ('webcms.module.glossary.apps.glossary', _('Glossary')),
    #
    #    ('webcms.module.media.apps.category_simple', _('Media categories')),
    #
    #    ('webcms.module.news.apps.news_archive', _('News archive')),
    #
    #    ('webcms.module.store.apps.core', _('Store (core application)')),
    #    ('webcms.module.store.apps.accounts', _('Store (user profile)')),
    #    ('webcms.module.store.apps.wishlist', _('Store (wishlist)')),
github mauler / nscms / nscms / portal / models.py View on Github external
#-*- coding:utf-8 -*-

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


from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^ckeditor\.fields\.RichTextField"])

Page.register_extensions('nscms.portal.page.extensions.tags',
                         'datepublisher',
                         'changedate',
                         'seo')


Page.create_content_type(RichTextContent)
github matthiask / django-content-editor / content / richtext / admin.py View on Github external
from django.contrib import admin

from feincms.admin import PageAdmin
from feincms.content.richtext import models
from feincms.models import Page


class RichTextContentInline(admin.StackedInline):
    model = models.RichTextContent
    extra = 1


PageAdmin.inlines.append(RichTextContentInline)

admin.site.unregister(Page)
admin.site.register(Page, PageAdmin)
github lvanderree / feincms-mercury / mercury / views.py View on Github external
if request.POST['content']:
            page_items = loads(request.POST['content'])

            for content_key, item in page_items.iteritems():
                # TODO: use form, so cleaned value can be retrieved

                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")
github feinheit / zipfelchappe / fhprojects / models.py View on Github external
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Page.create_content_type(ProjectTeaserContent)
Page.create_content_type(RawContent)


Project.register_regions(
    ('main', _('Content')),
    ('updates', _('Updates')),
)

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

Project.create_content_type(RichTextContent)
Project.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
github feinheit / zipfelchappe / fhprojects / models.py View on Github external
),
    })

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

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)
Page.create_content_type(ProjectTeaserContent)
Page.create_content_type(RawContent)


Project.register_regions(
    ('main', _('Content')),
    ('updates', _('Updates')),
)

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

Project.create_content_type(RichTextContent)