Django tables2 自定义列不呈现

Django tables2 custom columns not rendering

我正在尝试向我的 table 中的所有行添加一个 'Edit' 按钮,为此我正在使用 TemplateColumn,但它根本不呈现我的 table.

中的按钮

这就是我正在尝试的:

tables.py

from django_tables2 import tables, TemplateColumn
from .models import Conductores


class ConductoresTable(tables.Table):
    class Meta:
        model = Conductores
        template_name = "django_tables2/bootstrap-responsive.html"
        fields = ("nombres", "apellidos", "telefono", "edad", "ine", 'edit')
        attrs = {"class": "table table-hover table-sm"}
        edit = TemplateColumn(
            '<a class="btn btn btn-info btn-sm" href="{% url "conductor_edit" record.id %}">Editar</a>')

as you can see it show a '-' instead of the button.

我的问题是代码在 Meta 而不是 class 下,这解决了我的问题!