This commit is contained in:
Ross
2021-08-03 20:34:35 +01:00
parent cdc1259e56
commit accef904be
8 changed files with 96 additions and 13 deletions
+26 -2
View File
@@ -1,7 +1,7 @@
import django_tables2 as tables
from django_tables2.utils import A
from .models import Long, LongSeries
from .models import Long, LongSeries, CidUserAnswer
from django.utils.html import format_html
@@ -111,4 +111,28 @@ class LongSeriesTable(tables.Table):
def render_popup(self, value, record):
print(self)
return format_html("""<a href="#" onclick="return window.create_popup_window('/longs/series/{}', 'Series')" >Popup</a>""", record.pk)
return format_html("""<a href="#" onclick="return window.create_popup_window('/longs/series/{}', 'Series')" >Popup</a>""", record.pk)
class UserAnswerTable(tables.Table):
select = tables.CheckBoxColumn(accessor=("pk"))
delete = tables.LinkColumn(
"longs:user_answer_delete", text="Delete", args=[A("pk")], orderable=False
)
view = tables.LinkColumn('longs:user_answer_view',
text='View',
args=[A('pk')],
orderable=False)
class Meta:
model = CidUserAnswer
template_name = "django_tables2/bootstrap4.html"
fields = (
"cid",
"question",
"normal",
"answer",
#"answer_compare",
"exam",
"created",
"updated",
)