How to use the coderedcms.settings.cr_settings function in coderedcms

To help you get started, we’ve selected a few coderedcms 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 coderedcorp / coderedcms / coderedcms / forms.py View on Github external
def _check_whitelist(self, value):
        if cr_settings['PROTECTED_MEDIA_UPLOAD_WHITELIST']:
            if os.path.splitext(value.name)[1].lower() not in cr_settings['PROTECTED_MEDIA_UPLOAD_WHITELIST']:  # noqa
                raise ValidationError(self.error_messages['whitelist_file'])
github coderedcorp / coderedcms / coderedcms / models / wagtailsettings_models.py View on Github external
on_delete=models.SET_NULL,
        related_name='favicon',
        verbose_name=_('Favicon'),
    )
    navbar_color_scheme = models.CharField(
        blank=True,
        max_length=50,
        choices=cr_settings['FRONTEND_NAVBAR_COLOR_SCHEME_CHOICES'],
        default=cr_settings['FRONTEND_NAVBAR_COLOR_SCHEME_DEFAULT'],
        verbose_name=_('Navbar color scheme'),
        help_text=_('Optimizes text and other navbar elements for use with light or dark backgrounds.'),  # noqa
    )
    navbar_class = models.CharField(
        blank=True,
        max_length=255,
        default=cr_settings['FRONTEND_NAVBAR_CLASS_DEFAULT'],
        verbose_name=_('Navbar CSS class'),
        help_text=_('Custom classes applied to navbar e.g. "bg-light", "bg-dark", "bg-primary".'),
    )
    navbar_fixed = models.BooleanField(
        default=False,
        verbose_name=_('Fixed navbar'),
        help_text=_('Fixed navbar will remain at the top of the page when scrolling.'),
    )
    navbar_wrapper_fluid = models.BooleanField(
        default=True,
        verbose_name=_('Full width navbar'),
        help_text=_('The navbar will fill edge to edge.'),
    )
    navbar_content_fluid = models.BooleanField(
        default=False,
        verbose_name=_('Full width navbar contents'),
github coderedcorp / coderedcms / coderedcms / utils.py View on Github external
def attempt_protected_media_value_conversion(request, value):
    try:
        if value.startswith(cr_settings['PROTECTED_MEDIA_URL']):
            new_value = get_protected_media_link(request, value)
            return new_value
    except AttributeError:
        pass

    return value
github coderedcorp / coderedcms / coderedcms / blocks / layout_blocks.py View on Github external
from coderedcms.settings import cr_settings

from .base_blocks import BaseLayoutBlock, CoderedAdvColumnSettings


### Level 1 layout blocks


class ColumnBlock(BaseLayoutBlock):
    """
    Renders content in a column.
    """
    column_size = blocks.ChoiceBlock(
        choices=cr_settings['FRONTEND_COL_SIZE_CHOICES'],
        default=cr_settings['FRONTEND_COL_SIZE_DEFAULT'],
        required=False,
        label=_('Column size'),
    )

    advsettings_class = CoderedAdvColumnSettings

    class Meta:
        template = 'coderedcms/blocks/column_block.html'
        icon = 'placeholder'
        label = 'Column'


class GridBlock(BaseLayoutBlock):
    """
    Renders a row of columns.
    """
github coderedcorp / coderedcms / coderedcms / urls.py View on Github external
from coderedcms.views import (
    event_generate_ical_for_calendar,
    event_generate_recurring_ical_for_event,
    event_generate_single_ical_for_event,
    event_get_calendar_events,
    robots,
    serve_protected_file
)


urlpatterns = [
    # CodeRed custom URLs
    re_path(r'^sitemap\.xml$', cache_page(sitemap), name='codered_sitemap'),
    re_path(r'^robots\.txt$', cache_page(robots), name='codered_robots'),
    re_path(r'^{0}(?P
github coderedcorp / coderedcms / coderedcms / models / snippet_models.py View on Github external
)
    show_controls = models.BooleanField(
        default=True,
        verbose_name=_('Show controls'),
        help_text=_('Shows arrows on the left and right of the carousel to advance next or previous slides.'),  # noqa
    )
    show_indicators = models.BooleanField(
        default=True,
        verbose_name=_('Show indicators'),
        help_text=_('Shows small indicators at the bottom of the carousel based on the number of slides.'),  # noqa
    )
    animation = models.CharField(
        blank=True,
        max_length=20,
        choices=cr_settings['FRONTEND_CAROUSEL_FX_CHOICES'],
        default=cr_settings['FRONTEND_CAROUSEL_FX_DEFAULT'],
        verbose_name=_('Animation'),
        help_text=_('The animation when transitioning between slides.'),
    )

    panels = (
        [
            MultiFieldPanel(
                heading=_('Slider'),
                children=[
                    FieldPanel('name'),
                    FieldPanel('show_controls'),
                    FieldPanel('show_indicators'),
                    FieldPanel('animation'),
                ]
            ),
            InlinePanel('carousel_slides', label=_('Slides'))
github coderedcorp / coderedcms / coderedcms / templatetags / coderedcms_tags.py View on Github external
def process_form_cell(request, cell):
    if isinstance(cell, str) and cell.startswith(cr_settings['PROTECTED_MEDIA_URL']):
        return utils.get_protected_media_link(request, cell, render_link=True)
    if utils.uri_validator(str(cell)):
        return mark_safe("<a href="{0}">{1}</a>".format(cell, cell))
    return cell
github coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
def get_storage(self):
        return FileSystemStorage(
            location=cr_settings['PROTECTED_MEDIA_ROOT'],
            base_url=cr_settings['PROTECTED_MEDIA_URL']
        )
github coderedcorp / coderedcms / coderedcms / templatetags / coderedcms_tags.py View on Github external
def codered_settings(value):
    return cr_settings.get(value, None)
github coderedcorp / coderedcms / coderedcms / blocks / base_blocks.py View on Github external
def __init__(self, local_blocks=None, **kwargs):
        """
        Construct and inject settings block, then initialize normally.
        """
        klassname = self.__class__.__name__.lower()
        choices = cr_settings['FRONTEND_TEMPLATES_BLOCKS'].get('*', ()) + \
                  cr_settings['FRONTEND_TEMPLATES_BLOCKS'].get(klassname, ())

        if not local_blocks:
            local_blocks = ()

        local_blocks += (('settings', self.advsettings_class(template_choices=choices)),)

        super().__init__(local_blocks, **kwargs)