How to use the feincms3.apps.AppsMixin function in feincms3

To help you get started, we’ve selected a few feincms3 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 / feincms3 / tests / testapp / models.py View on Github external
from feincms3.apps import AppsMixin, reverse_app
from feincms3.mixins import (
    LanguageAndTranslationOfMixin,
    MenuMixin,
    RedirectMixin,
    TemplateMixin,
)
from feincms3.pages import AbstractPage
from feincms3.plugins import external, html, image, richtext, snippet


class Page(
    AbstractPage,
    # For adding the articles app to pages through the CMS:
    AppsMixin,
    # Two page templates, one with only a main region and another with a
    # sidebar as well:
    TemplateMixin,
    # We have a main and a footer navigation (meta):
    MenuMixin,
    # We're building a multilingual CMS. (Also, feincms3.apps depends on
    # LanguageMixin currently):
    LanguageAndTranslationOfMixin,
    # Allow redirecting pages to other pages and/or arbitrary URLs:
    RedirectMixin,
):

    # TemplateMixin
    TEMPLATES = [
        Template(
            key="standard",
github matthiask / feincms3-example / app / pages / models.py View on Github external
from __future__ import unicode_literals

from django.db import models
from django.utils.translation import gettext_lazy as _

from content_editor.models import Region, Template, create_plugin_base

from feincms3.apps import AppsMixin
from feincms3.mixins import TemplateMixin, MenuMixin, LanguageMixin
from feincms3.pages import AbstractPage
from feincms3.plugins import image, richtext


class Page(
    AbstractPage,
    AppsMixin,      # For adding the articles app to pages through the CMS.
    TemplateMixin,  # Two page templates, one with only a main
                    # region and another with a sidebar as well.
    MenuMixin,      # We have a main and a footer navigation (meta).
    LanguageMixin,  # We're building a multilingual CMS. (Also,
                    # feincms3.apps depends on LanguageMixin
                    # currently.)
):

    # TemplateMixin
    TEMPLATES = [
        Template(
            key='standard',
            title=_('standard'),
            template_name='pages/standard.html',
            regions=(
                Region(key='main', title=_('Main')),
github matthiask / feincms3 / feincms3 / apps.py View on Github external
    @staticmethod
    def fill_application_choices(sender, **kwargs):
        """
        Fills in the choices for ``application`` from the ``APPLICATIONS``
        class variable. This method is a receiver of Django's
        ``class_prepared`` signal.
        """
        if issubclass(sender, AppsMixin) and not sender._meta.abstract:
            sender._meta.get_field("application").choices = [
                app[:2] for app in sender.APPLICATIONS
            ]
            global _APPS_MODEL
            _APPS_MODEL = sender


signals.class_prepared.connect(AppsMixin.fill_application_choices)
github matthiask / feincms3 / feincms3 / apps.py View on Github external
def fill_application_choices(sender, **kwargs):
        """
        Fills in the choices for ``application`` from the ``APPLICATIONS``
        class variable. This method is a receiver of Django's
        ``class_prepared`` signal.
        """
        if issubclass(sender, AppsMixin) and not sender._meta.abstract:
            sender._meta.get_field("application").choices = [
                app[:2] for app in sender.APPLICATIONS
            ]
            global _APPS_MODEL
            _APPS_MODEL = sender