# admin.py
from django import forms
from django.contrib import admin

from ..models.email_setting import EmailSetting
from .mixins import SingletonAdminMixin


class EmailSettingAdminForm(forms.ModelForm):

    class Meta:
        model = EmailSetting
        fields = '__all__'
        widgets = {
            'email_enabled': forms.RadioSelect,
            'use_tls': forms.RadioSelect,
        }


@admin.register(EmailSetting)
class EmailSettingAdmin(SingletonAdminMixin, admin.ModelAdmin):
    form = EmailSettingAdminForm
