from django.contrib import admin

from feedback.models import DetectionFeedback


@admin.register(DetectionFeedback)
class DetectionFeedbackAdmin(admin.ModelAdmin):
    list_display = ('user', 'source_type', 'is_correct', 'submit_time')

    def get_status_color(self, obj):
        if obj.is_correct:
            return '<span style="color:green;">准确</span>'
        return '<span style="color:red;">纠错</span>'

    get_status_color.short_description = '状态'
    get_status_color.allow_tags = True