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
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import A
|
from django_tables2.utils import A
|
||||||
|
|
||||||
from generic.tables import SingleImageColumn
|
from generic.tables import SingleImageColumn, SelectionTable
|
||||||
|
|
||||||
from .models import AnatomyQuestion, UserAnswer
|
from .models import AnatomyQuestion, UserAnswer
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
|||||||
|
|
||||||
#from generic.tables import UserAnswerTable
|
#from generic.tables import UserAnswerTable
|
||||||
|
|
||||||
class AnatomyQuestionTable(tables.Table):
|
class AnatomyQuestionTable(SelectionTable):
|
||||||
edit = tables.LinkColumn(
|
edit = tables.LinkColumn(
|
||||||
"anatomy:anatomy_question_update", text="Edit", args=[A("pk")], orderable=False
|
"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")
|
exams = tables.ManyToManyColumn(verbose_name="Exams")
|
||||||
|
|
||||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
class Meta(SelectionTable.Meta):
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = AnatomyQuestion
|
model = AnatomyQuestion
|
||||||
template_name = "django_tables2/bootstrap4.html"
|
template_name = "django_tables2/bootstrap4.html"
|
||||||
fields = (
|
fields = (
|
||||||
|
|||||||
+4
-4
@@ -2,7 +2,7 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import A
|
from django_tables2.utils import A
|
||||||
|
|
||||||
from generic.tables import FirstImageColumn
|
from generic.tables import FirstImageColumn, SelectionTable
|
||||||
|
|
||||||
from .models import Question, UserAnswer
|
from .models import Question, UserAnswer
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QuestionTable(tables.Table):
|
class QuestionTable(SelectionTable):
|
||||||
edit = tables.LinkColumn('shorts:question_update',
|
edit = tables.LinkColumn('shorts:question_update',
|
||||||
text='Edit',
|
text='Edit',
|
||||||
args=[A('pk')],
|
args=[A('pk')],
|
||||||
@@ -36,9 +36,9 @@ class QuestionTable(tables.Table):
|
|||||||
|
|
||||||
exams = tables.ManyToManyColumn(verbose_name="Exams")
|
exams = tables.ManyToManyColumn(verbose_name="Exams")
|
||||||
|
|
||||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
#selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta(SelectionTable.Meta):
|
||||||
model = Question
|
model = Question
|
||||||
template_name = "django_tables2/bootstrap4.html"
|
template_name = "django_tables2/bootstrap4.html"
|
||||||
fields = ("normal", "examination",
|
fields = ("normal", "examination",
|
||||||
|
|||||||
Reference in New Issue
Block a user