from django.template.loader import render_to_string
from garpix_page.template import template_source
from garpix_page.utils import apply_string_handling

__all__ = ('get_render_html_value', )


def get_render_html_value(default_html, apply_django_tag=False):
    def _get_render_html_value():
        if not apply_django_tag:
            return apply_string_handling(
                template_source.get_template(default_html).template
            )

        return apply_string_handling(render_to_string(default_html))

    return _get_render_html_value
