Document supported table columns

This commit is contained in:
jeremystretch
2022-02-09 14:31:40 -05:00
parent 23a80770e1
commit ee566723d7
2 changed files with 59 additions and 5 deletions

View File

@@ -75,7 +75,8 @@ class BooleanColumn(tables.Column):
class TemplateColumn(tables.TemplateColumn):
"""
Overrides the stock TemplateColumn to render a placeholder if the returned value is an empty string.
Overrides django-tables2's stock TemplateColumn class to render a placeholder symbol if the returned value
is an empty string.
"""
PLACEHOLDER = mark_safe('—')
@@ -219,7 +220,7 @@ class ContentTypesColumn(tables.ManyToManyColumn):
class ColorColumn(tables.Column):
"""
Display a color (#RRGGBB).
Display an arbitrary color value, specified in RRGGBB format.
"""
def render(self, value):
return mark_safe(
@@ -232,7 +233,8 @@ class ColorColumn(tables.Column):
class ColoredLabelColumn(tables.TemplateColumn):
"""
Render a colored label (e.g. for DeviceRoles).
Render a related object as a colored label. The related object must have a `color` attribute (specifying
an RRGGBB value) and a `get_absolute_url()` method.
"""
template_code = """
{% load helpers %}
@@ -283,7 +285,7 @@ class LinkedCountColumn(tables.Column):
class TagColumn(tables.TemplateColumn):
"""
Display a list of tags assigned to the object.
Display a list of Tags assigned to the object.
"""
template_code = """
{% load helpers %}
@@ -342,7 +344,7 @@ class CustomFieldColumn(tables.Column):
class CustomLinkColumn(tables.Column):
"""
Render a custom links as a table column.
Render a custom link as a table column.
"""
def __init__(self, customlink, *args, **kwargs):
self.customlink = customlink