from django.contrib import admin
from unfold.admin import ModelAdmin
from .models import NotifModel
from import_export.admin import ImportExportModelAdmin
from unfold.contrib.import_export.forms import ExportForm, ImportForm, SelectableFieldsExportForm

@admin.register(NotifModel)
class NotifModelAdmin(ModelAdmin, ImportExportModelAdmin):
    import_form_class = ImportForm
    export_form_class = ExportForm
    compressed_fields = True
    warn_unsaved_form = True

    list_display = ('subject', 'priority', 'send_time', 'send_by', 'send_to_all')
    search_fields = ('subject', 'description', 'send_by__email', 'send_to_branch__name')
    list_filter = ('priority', 'send_time', 'send_to_all')
    ordering = ('-send_time',)
    filter_horizontal = ('send_to_branch', 'read_by')
