Create ButtonsColumnMixin

pull/10940/head
Sage Abdullah 2023-09-25 11:08:39 +01:00
rodzic b32c5c08cd
commit cbd82f06de
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
1 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -157,6 +157,20 @@ class Column(BaseColumn):
return context
class ButtonsColumnMixin:
"""A mixin for columns that contain buttons"""
buttons = []
def get_cell_context_data(self, instance, parent_context):
context = super().get_cell_context_data(instance, parent_context)
context["buttons"] = self.get_buttons(instance, parent_context)
return context
def get_buttons(self, instance, parent_context):
return self.buttons
class TitleColumn(Column):
"""A column where data is styled as a title and wrapped in a link or <label>"""