from django.contrib import admin
from django.db.models import JSONField

from vbv_lernwelt.assignment.models import AssignmentCompletion
from vbv_lernwelt.core.admin_utils import PrettyJSONWidget


@admin.register(AssignmentCompletion)
class AssignmentCompletionAdmin(admin.ModelAdmin):
    formfield_overrides = {
        JSONField: {"widget": PrettyJSONWidget(attrs={"rows": 16, "cols": 80})},
    }
    date_hierarchy = "created_at"
    list_display = [
        "id",
        "completion_status",
        "assignment",
        "assignment_user",
        "course_session",
    ]
