Implement selection-enabled table base class and update QuestionTable to inherit from it
This commit is contained in:
@@ -12,6 +12,28 @@ from generic.models import CidUser, Examination, Supervisor, findMiddle
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Generic selection-enabled table base class.
|
||||
# Inherit from this class to automatically get a selection checkbox
|
||||
# column (input name="selection") and table attrs that client-side
|
||||
# scripts can use to find selectable tables.
|
||||
class SelectionTable(tables.Table):
|
||||
# Provide a default selection checkbox column. Subclasses that wish to
|
||||
# customise can override this attribute.
|
||||
selection = tables.CheckBoxColumn(
|
||||
accessor="pk",
|
||||
orderable=False,
|
||||
attrs={
|
||||
'th': {'class': 'selection-col'},
|
||||
'td': {'class': 'selection-col'},
|
||||
'input': {'name': 'selection'},
|
||||
},
|
||||
verbose_name=''
|
||||
)
|
||||
|
||||
class Meta:
|
||||
# Defaults: add js-row-selectable class so client-side code can
|
||||
# locate tables that support row selection.
|
||||
attrs = {"class": "table js-row-selectable", "data-selection-name": "selection"}
|
||||
|
||||
class SingleImageColumn(tables.Column):
|
||||
def render(self, value):
|
||||
|
||||
Reference in New Issue
Block a user