How to use the feincms.module.page.models.Page.objects 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 feinheit / django-facebook-graph / facebook / feincms / utils.py View on Github external
def get_application_from_request(request):
    try:
        page = Page.objects.for_request(request, best_match=True)
        return getattr(page, 'facebook_application', None)
    except Page.DoesNotExist:
        return None
github bmihelac / feincms-feincmsext / feincmsext / extended_navigation / templatetags / feincmsext_extended_navigation_tags.py View on Github external
def get_navigation(start_page=None, level=0, depth=1, active_depth=0,
        language=None, navigation_type=None, extended=False,
        request=None):
    if not start_page:
        root = Page.objects
    else:
        if (start_page.level < level - 1):
            return []
        if start_page.is_root_node() or (start_page.level == level - 1):
            root_page = start_page
        else:
            root_page = start_page.get_ancestors().get(level=max(level - 1, 0))
        root = Page.objects.filter(lft__gte=root_page.lft,
                rght__lte=root_page.rght, tree_id=root_page.tree_id)
    from_level = level
    to_level = level + depth
    queryset = root.filter(level__gte=from_level,
            level__lt=to_level, in_navigation=True)
    if language:
        queryset = queryset.filter(language=language)
    if navigation_type:
github feinheit / django-facebook-graph / facebook / feincms / utils.py View on Github external
def get_page_from_request(request):
    try:
        page = Page.objects.for_request(request, best_match=True)
        return getattr(page, 'facebook_page', None)
    except Page.DoesNotExist:
        return None
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],
github feincms / feincms / example / management / commands / generate_big_tree.py View on Github external
)

            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):
                        parents[3] = Page.objects.create(
                            title='Page %s.%s.%s.%s' % (i1, i2, i3, i4),
                            parent=parents[2],
                        )
github bmihelac / feincms-feincmsext / feincmsext / util / structure.py View on Github external
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)