Skip to content
Snippets Groups Projects
Verified Commit 51328fc9 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add column for django-tables2 which supports the ActionForm

parent 5db81146
Branches 576-error-uploading-favicon-to-s3
No related tags found
1 merge request!502Add support to build tables and forms for executing actions for multiple objects
......@@ -118,3 +118,15 @@ class MaterializeCheckboxColumn(tables.CheckBoxColumn):
return mark_safe( # noqa
"<label><input %s/><span></span</label>" % AttributeDict(attrs).as_html()
)
class SelectColumn(MaterializeCheckboxColumn):
"""Column with a check box prepared for `ActionForm` forms."""
def __init__(self, *args, **kwargs):
kwargs["attrs"] = {
"td__input": {"name": "selected_objects"},
"th__input": {"id": "header_box"},
}
kwargs.setdefault("accessor", A("pk"))
super().__init__(*args, **kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment