from django.template import Library
from django.conf import settings

register = Library()


@register.inclusion_tag('custom_css.html', takes_context=True)
def custom_css(context):
    styles = {
        "body_border_color": settings.CUSTOM_CSS_BASE_BACKGROUND_COLOR,
        "body_font_family": settings.CUSTOM_CSS_BODY_FONT_FAMILY,
        "block_background_color": settings.CUSTOM_CSS_BLOCK_BACKGROUND_COLOR,
        "block_font_family": settings.CUSTOM_CSS_BLOCK_FONT_FAMILY,
        "text_transform": settings.CUSTOM_CSS_BLOCK_TEXT_TRANSFORM,
        "accent_1": settings.CUSTOM_CSS_ACCENT_1,
        "accent_2": settings.CUSTOM_CSS_ACCENT_2
    }
    return styles


@register.simple_tag(takes_context=True)
def get_site_name(context):
    return settings.SITE_NAME


@register.assignment_tag(takes_context=True)
def load_sections(context):
    request = context['request']
    locale_code = context.get('locale_code')

    if request.site:
        qs = request.site.root_page.specific.sections()
    else:
        qs = []

    return [a.get_translation_for(locale_code) or a for a in qs]

@@ -769,327 +769,4 @@
 AME%0A
-%0A%0A@register.assignment_tag(takes_context=True)%0Adef load_sections(context):%0A    request = context%5B'request'%5D%0A    locale_code = context.get('locale_code')%0A%0A    if request.site:%0A        qs = request.site.root_page.specific.sections()%0A    else:%0A        qs = %5B%5D%0A%0A    return %5Ba.get_translation_for(locale_code) or a for a in qs%5D%0A

remove template and page publish tag