from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from django.forms import widgets




class FeedbackForm(forms.Form):
    # account_type = forms.ChoiceField(choices=account_type_choices, initial='sender', required=True)
    form_name = forms.CharField(label=_('Название формы'), required=True)
    name = forms.CharField(label=_('Имя'), required=True)
    company = forms.CharField(label=_('Компания'), required=True)

    contacts = forms.CharField(label=_('Контактные данные'), required=True)
    description = forms.CharField(label=_('Тематика запроса'), required=True)

    agreement = forms.BooleanField(
        label=_('Принимаю пользовательское соглашение и принимаю условия обработки личных данных'),
        initial=False, required=True
    )

    def __init__(self, *args, **kwargs):
        del_descr = False
        if kwargs:
            if ('del_descr' in kwargs and kwargs['del_descr']) or (not 'description' in kwargs['data']):
                del_descr = True
            if 'del_descr' in kwargs:
                del kwargs['del_descr']
        super(FeedbackForm, self).__init__(*args, **kwargs)
        if del_descr:
            del self.fields['description']
