import django_tables2 as tables
from django_tables2.utils import A

from generic.tables import SeriesImageColumn

from .models import (
    Entry,
    Formats
)

from django.utils.html import format_html





class EntryTable(tables.Table):
    view = tables.LinkColumn(
        "oef:entry_detail", text="View", args=[A("pk")], orderable=False
    )
    edit = tables.LinkColumn(
        "oef:entry_update", text="Edit", args=[A("pk")], orderable=False
    )

    class Meta:
        model = Entry
        template_name = "django_tables2/bootstrap4.html"
        fields = (
            "modality",
            "exam_code",
            "exam_name",
            "questions",
            "comments",
        )


    def render_questions(self, value):
        return format_html("<pre>{}</pre>", value)
