from django.forms import ModelForm, CharField, BooleanField, ImageField, ModelChoiceField, ModelMultipleChoiceField, BooleanField from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from django.contrib.auth import get_user_model from phonenumber_field.formfields import PhoneNumberField from django_countries.fields import CountryField from internationalflavor.vat_number.forms import VATNumberFormField from core.models.local import Currency from core.models.brands import Brand class AdminEditForm(ModelForm): display_name = CharField(required=False, label=_('Internal Display Name')) mobile = PhoneNumberField(required=False, label=_('Mobile Number')) role = CharField(required=False, label=_("Role")) image = ImageField(required=False, label=_("Image")) remove_image = BooleanField(required=False, label=_("Remove image from profile?")) class Meta: model = get_user_model() fields = ('first_name', 'last_name', "display_name", "email", 'mobile', "role", "image", "remove_image") class AdminCreateForm(ModelForm): display_name = CharField(required=False, label=_('Internal Display Name')) mobile = PhoneNumberField(required=False, label=_('Mobile Number')) role = CharField(required=False, label=_("Role")) image = ImageField(required=False, label=_("Image")) class Meta: model = get_user_model() fields = ('first_name', 'last_name', "display_name", "email", 'mobile', "role", "image") class ClientForm(ModelForm): company = CharField(required=False, label=_('Company Name')) mobile = PhoneNumberField(required=False, label=_('Mobile Number')) address1 = CharField(label=_('Address')) address2 = CharField(label=_('Address')) zip = CharField(label=_('ZIP')) city = CharField(label=_('City')) state = CharField(label=_('State')) country = CountryField() vat_id = VATNumberFormField(label=_('VAT Number')) company_id = CharField(label=_('Company Registration Number')) default_currency = ModelChoiceField(Currency.objects.all(), label=_("Default Currency")) brands = ModelMultipleChoiceField(Brand.objects.all(), label=_("Associated Brands")) marketing_opt_in = BooleanField(label=_("Opted in to marketing messages")) pgp_key = CharField(label=_("GPG encryption key")) class Meta: model = get_user_model() fields = ('first_name', 'last_name', "company", "email", 'mobile')