def generate_dot(graph_data):
    t = loader.get_template('django_extensions/graph_models/digraph.dot')

    if not isinstance(t, Template) and not (hasattr(t, 'template') and isinstance(t.template, Template)):
        raise Exception("Default Django template loader isn't used. "
                        "This can lead to the incorrect template rendering. "
                        "Please, check the settings.")

    c = Context(graph_data)
    if django.VERSION >= (1, 8):
        c = c.flatten()
    dot = t.render(c)

    return dot
dataset/ETHPy150Open django-extensions/django-extensions/django_extensions/management/modelviz.py/generate_dot/original