Beispiel #1
0
def render_region_tools(context, feincms_object, region, request=None):
    """
    {% render_region_tools feincms_page "main" request %}

    skip rendering in standalone mode
    """

    if context.get('standalone', False) or not feincms_object:
        return {}

    edit = False

    if getattr(settings, 'LEONARDO_USE_PAGE_ADMIN', False):
        request = context.get('request', None)
        frontend_edit = request.COOKIES.get('frontend_editing', False)
        if frontend_edit:
            edit = True

    return {
        'edit':
        edit,
        'feincms_object':
        feincms_object,
        'region':
        region,
        'region_name':
        get_page_region(region),
        'widget_add_url':
        reverse_lazy('widget_create',
                     args=[
                         feincms_object.id, region,
                         '%s.%s' % (feincms_object._meta.app_label,
                                    feincms_object.__class__.__name__)
                     ])
    }
def render_region_tools(context, feincms_object, region, request=None):
    """
    {% render_region_tools feincms_page "main" request %}

    skip rendering in standalone mode
    """

    if context.get('standalone', False) or not feincms_object:
        return {}

    edit = False

    if getattr(settings, 'LEONARDO_USE_PAGE_ADMIN', False):
        request = context.get('request', None)
        frontend_edit = request.COOKIES.get(
            'frontend_editing', False)
        if frontend_edit:
            edit = True

    return {
        'edit': edit,
        'feincms_object': feincms_object,
        'region': region,
        'widget_add_url': reverse_lazy(
            'widget_create',
            args=[feincms_object.id,
                  region,
                  '%s.%s' % (feincms_object._meta.app_label,
                             feincms_object.__class__.__name__)
                  ])
    }
def render_region_tools(context, feincms_object, region, request=None):
    """
    {% render_region_tools feincms_page "main" request %}

    skip rendering in standalone mode
    """

    if context.get("standalone", False) or not feincms_object:
        return {}

    edit = False

    if getattr(settings, "LEONARDO_USE_PAGE_ADMIN", False):
        request = context.get("request", None)
        frontend_edit = request.COOKIES.get("frontend_editing", False)
        if frontend_edit:
            edit = True

    return {
        "edit": edit,
        "feincms_object": feincms_object,
        "region": region,
        "region_name": get_page_region(region),
        "widget_add_url": reverse_lazy(
            "widget_create",
            args=[
                feincms_object.id,
                region,
                "%s.%s" % (feincms_object._meta.app_label, feincms_object.__class__.__name__),
            ],
        ),
    }
def feincms_object_tools(context, cls_name):
    """
    {% feincms_object_tools 'article' %}
    {% feincms_object_tools 'web.page' %}

    render add feincms object entry
    """
    if context.get("standalone", False):
        return {}
    edit = False
    if getattr(settings, "LEONARDO_USE_PAGE_ADMIN", False):
        request = context.get("request", None)
        frontend_edit = request.COOKIES.get("frontend_editing", False)
        if frontend_edit:
            edit = True

    return {"edit": edit, "add_entry_url": reverse_lazy("horizon:contrib:forms:create", args=[cls_name])}
Beispiel #5
0
def feincms_object_tools(context, cls_name):
    """
    {% feincms_object_tools 'article' %}
    {% feincms_object_tools 'web.page' %}

    render add feincms object entry
    """
    if context.get('standalone', False):
        return {}
    edit = False
    if getattr(settings, 'LEONARDO_USE_PAGE_ADMIN', False):
        request = context.get('request', None)
        frontend_edit = request.COOKIES.get('frontend_editing', False)
        if frontend_edit:
            edit = True

    return {
        'edit':
        edit,
        'add_entry_url':
        reverse_lazy('horizon:contrib:forms:create', args=[cls_name])
    }
def feincms_object_tools(context, cls_name):
    """
    {% feincms_object_tools 'article' %}
    {% feincms_object_tools 'web.page' %}

    render add feincms object entry
    """
    if context.get('standalone', False):
        return {}
    edit = False
    if getattr(settings, 'LEONARDO_USE_PAGE_ADMIN', False):
        request = context.get('request', None)
        frontend_edit = request.COOKIES.get(
            'frontend_editing', False)
        if frontend_edit:
            edit = True

    return {
        'edit': edit,
        'add_entry_url': reverse_lazy(
            'horizon:contrib:forms:create',
            args=[cls_name])
    }