from django.forms import ModelForm, CharField, BooleanField, ImageField 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 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")