diff --git a/django_tables2/columns/checkboxcolumn.py b/django_tables2/columns/checkboxcolumn.py
index 2c2bd16e..9543c3e6 100644
--- a/django_tables2/columns/checkboxcolumn.py
+++ b/django_tables2/columns/checkboxcolumn.py
@@ -1,6 +1,6 @@
from django.utils.safestring import mark_safe
-from django_tables2.utils import Accessor, AttributeDict
+from django_tables2.utils import Accessor, AttributeDict, computed_values
from .base import Column, library
@@ -65,8 +65,10 @@ def render(self, value, bound_column, record):
general = self.attrs.get("input")
specific = self.attrs.get("td__input")
- attrs = AttributeDict(default, **(specific or general or {}))
- return mark_safe("" % attrs.as_html())
+
+ attrs = dict(default, **(specific or general or {}))
+ attrs = computed_values(attrs, kwargs={"record": record, "value": value})
+ return mark_safe("" % AttributeDict(attrs).as_html())
def is_checked(self, value, record):
"""
diff --git a/tests/columns/test_checkboxcolumn.py b/tests/columns/test_checkboxcolumn.py
index aa039308..68a0f1b9 100644
--- a/tests/columns/test_checkboxcolumn.py
+++ b/tests/columns/test_checkboxcolumn.py
@@ -89,3 +89,17 @@ class TestTable(tables.Table):
"value": "2",
"name": "col",
}
+
+ def test_column_callable_attrs(self):
+ class TestTable(tables.Table):
+ col = tables.CheckBoxColumn(
+ attrs={"input": {"data-source": lambda record: record["col"]}}
+ )
+
+ table = TestTable([{"col": "1"}])
+ assert attrs(table.rows[0].get_cell("col")) == {
+ "type": "checkbox",
+ "value": "1",
+ "name": "col",
+ "data-source": "1",
+ }