# Path: djedi/compat.py
# def patterns(*urls):
#         def parse_bits(parser, bits, params, varargs, varkw, defaults,
#                        takes_context, name):
#     def generic_tag_compiler(parser, token, params, varargs, varkw, defaults,
#                              name, takes_context, node_class):
#         def __init__(self, *args, **kwargs):
#     def get_cache(name):
#     def getargspec(func):
#     class TemplateResponse(BaseTemplateResponse):


import json
from django.core.exceptions import ImproperlyConfigured
from ..compat import NoReverseMatch, render, render_to_string, reverse




def render_embed(nodes=None, request=None):
    context = {}

    if nodes is None:
        try:
            prefix = request.build_absolute_uri("/").rstrip("/")
            context.update(
                {
                    "cms_url": prefix + reverse("admin:djedi:cms"),
                    "exclude_json_nodes": True,
                }
            )
            output = render(request, "djedi/cms/embed.html", context)
        except NoReverseMatch:
            raise ImproperlyConfigured(
                "Could not find djedi in your url conf, "
                "enable django admin or include "
                "djedi.urls within the admin namespace."
            )

    else:
        context.update(
            {

# Path: djedi/compat.py
# def patterns(*urls):
#         def parse_bits(parser, bits, params, varargs, varkw, defaults,
#                        takes_context, name):
#     def generic_tag_compiler(parser, token, params, varargs, varkw, defaults,
#                              name, takes_context, node_class):
#         def __init__(self, *args, **kwargs):
#     def get_cache(name):
#     def getargspec(func):
#     class TemplateResponse(BaseTemplateResponse):


# Path: djedi/utils/templates.py
import json
from django.core.exceptions import ImproperlyConfigured
from ..compat import NoReverseMatch, render, render_to_string, reverse





def render_embed(nodes=None, request=None):
    context = {}

    if nodes is None:
        try:
            prefix = request.build_absolute_uri("/").rstrip("/")
            context.update(
                {
                    "cms_url": prefix + reverse("admin:djedi:cms"),
                    "exclude_json_nodes": True,
                }
            )
            output = render(request, "djedi/cms/embed.html", context)
        except NoReverseMatch:
            raise ImproperlyConfigured(
                "Could not find djedi in your url conf, "
                "enable django admin or include "
                "djedi.urls within the admin namespace."
            )

    else:
        context.update(
            {

                "cms_url": reverse("admin:djedi:cms"),