Refactor tables to inherit from SelectionTable for consistent behavior across Anatomy and Question tables
This commit is contained in:
+3
-5
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
from django_tables2.utils import A
|
||||
|
||||
from generic.tables import SingleImageColumn
|
||||
from generic.tables import SingleImageColumn, SelectionTable
|
||||
|
||||
from .models import AnatomyQuestion, UserAnswer
|
||||
|
||||
@@ -13,7 +13,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
#from generic.tables import UserAnswerTable
|
||||
|
||||
class AnatomyQuestionTable(tables.Table):
|
||||
class AnatomyQuestionTable(SelectionTable):
|
||||
edit = tables.LinkColumn(
|
||||
"anatomy:anatomy_question_update", text="Edit", args=[A("pk")], orderable=False
|
||||
)
|
||||
@@ -30,9 +30,7 @@ class AnatomyQuestionTable(tables.Table):
|
||||
)
|
||||
exams = tables.ManyToManyColumn(verbose_name="Exams")
|
||||
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
class Meta:
|
||||
class Meta(SelectionTable.Meta):
|
||||
model = AnatomyQuestion
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = (
|
||||
|
||||
Reference in New Issue
Block a user