[Fixed]-Django: include template into view

1👍

You can use render_to_string:

from django.template.loader import render_to_string

class MyTable(django_tables2.Table):
    [...]
    def render_mycolumn(self, value):
        values = [...]

        s = render_to_string('path/to/template.html', { 'key': 'value' })
        return mark_safe(s)

Leave a comment