from django.contrib import admin
from .models import *


from import_export.admin import ImportExportModelAdmin
from unfold.contrib.import_export.forms import ExportForm, ImportForm, SelectableFieldsExportForm
from unfold.contrib.forms.widgets import ArrayWidget, WysiwygWidget
from django.contrib.postgres.fields import ArrayField
from utils.admin import ModelAdmin

@admin.register(ProductChatModel)
class ProductChatAdmin(ModelAdmin, ImportExportModelAdmin):
    import_form_class = ImportForm
    export_form_class = ExportForm
    
    readonly_fields = ('user', 'product', 'thread')

    compressed_fields = True
    warn_unsaved_form = True

    formfield_overrides = {
        ArrayField: {
            "widget": ArrayWidget,
        }
    }
