How to use the feincms.module.page.models.Page 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 bmihelac / feincms-feincmsext / feincmsext / simple_permission / tests.py View on Github external
def setUp(self):
        self.curr_auth = settings.AUTHENTICATION_BACKENDS
        settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
        self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
        self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
        self.page_1 = Page.objects.create(title='1', slug='1', parent=None)
        self.page_1_1 = Page.objects.create(title='1.1', slug='1.1', parent=self.page_1)
        self.page_1 = Page.objects.get(pk=self.page_1.id)
        self.page_1_1_1 = Page.objects.create(title='1.1.1', slug='1.1.1', parent=self.page_1_1)
        self.page_1 = Page.objects.get(pk=self.page_1.id)
        self.page_1_1 = Page.objects.get(pk=self.page_1_1.id)
        self.page_1_2 = Page.objects.create(title='1.2', slug='1.2', parent=self.page_1)
        self.page_1 = Page.objects.get(pk=self.page_1.id)
        self.page_1_3 = Page.objects.create(title='1.3', slug='1.3', parent=self.page_1)
github feincms / feincms / tests / testapp / models.py View on Github external
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(processors.debug_sql_queries_response_processor())


def get_admin_fields(form, *args, **kwargs):
    return {
        "exclusive_subpages": forms.BooleanField(
            label=capfirst(_("exclusive subpages")),
            required=False,
github feincms / feincms / 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 feincms / feincms / feincms / management / commands / medialibrary_to_filer.py View on Github external
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()
github django-leonardo / django-leonardo / leonardo / module / web / search.py View on Github external
title = fields.CharField(model_attr="title")

    creation_date = fields.DateTimeField(model_attr='creation_date', null=True)
    modification_date = fields.DateTimeField(model_attr='modification_date', null=True)

    def should_update(self, instance, **kwargs):
        return instance.is_active()

    def get_queryset(self):
        """Return a Django QuerySet used for all search-related queries. Currently we index all active pages"""
        return Page.objects.active()

    def get_updated_field(self):
        return "modification_date"

site.register(Page, PageIndex)
github feincms / feincms / example / management / commands / generate_big_tree.py View on Github external
def handle_noargs(self, **options):
        parents = [None] * 5

        Page.objects.all().delete()

        for i1 in range(5):
            parents[0] = Page.objects.create(
                title='Page %s' % (i1,),
            )

            for i2 in range(5):
                parents[1] = Page.objects.create(
                    title='Page %s.%s' % (i1, i2),
                    parent=parents[0],
                )

                for i3 in range(5):
                    parents[2] = Page.objects.create(
                        title='Page %s.%s.%s' % (i1, i2, i3),
                        parent=parents[1],
                    )

                    for i4 in range(5):