class InternationalContactForm(SerializeDataMixin, GovNotifyEmailActionMixin, forms.Form): ORGANISATION_TYPE_CHOICES = ( ('COMPANY', 'Company'), ('OTHER', 'Other type of organisation'), ) given_name = forms.CharField() family_name = forms.CharField() email = forms.EmailField(label='Email address') organisation_type = forms.ChoiceField(label_suffix='', widget=forms.RadioSelect(), choices=ORGANISATION_TYPE_CHOICES) organisation_name = forms.CharField(label='Your organisation name') country_name = forms.ChoiceField(choices=[('', 'Please select')] + choices.COUNTRY_CHOICES, ) city = forms.CharField(label='City') comment = forms.CharField( label='Tell us how we can help', help_text=('Do not include personal information or anything of a ' 'sensitive nature'), widget=Textarea, ) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
class PersonalDetailsForm(forms.Form): error_css_class = 'input-field-container has-error' firstname = forms.CharField(label='Your first name') lastname = forms.CharField(label='Your last name') position = forms.CharField(label='Position in company') email = forms.EmailField(label='Email address') phone = forms.CharField(label='Phone')
class ConsumerGroupForm(forms.Form): given_name = forms.CharField(label='Given name', ) family_name = forms.CharField(label='Family name') email = forms.EmailField(label='Email address') organisation_name = forms.CharField(label='Organisation name', ) consumer_regions = fields.MultipleChoiceAutocomplateField( label='Where are most of your consumers based?', choices=choices.EXPERTISE_REGION_CHOICES, required=False, )
class DomesticContactForm(FieldsMutationMixin, SerializeMixin, ZendeskActionMixin, ConsentFieldMixin, forms.Form): first_name = forms.CharField() last_name = forms.CharField() email = forms.EmailField() organisation_type = forms.ChoiceField(label_suffix='', widget=forms.RadioSelect(), choices=COMPANY_CHOICES) company_name = forms.CharField() comment = forms.CharField(widget=Textarea, validators=[no_html, not_contains_url_or_email]) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3())
class SaveForLaterForm(GovNotifyEmailActionMixin, forms.Form): email = forms.EmailField(label='Email address') def __init__(self, return_url, *args, **kwargs): super().__init__(*args, **kwargs) self.return_url = return_url @property def serialized_data(self): return { **super().serialized_data, 'url': self.return_url, }
class ConsumerPersonalDetailsForm(forms.Form): given_name = forms.CharField(label='Given name', ) family_name = forms.CharField(label='Family name') email = forms.EmailField(label='Email address') income_bracket = forms.ChoiceField( label='Personal income before tax (optional)', required=False, choices=INCOME_BRACKET_CHOICES) consumer_region = forms.ChoiceField( label='Where do you live (optional)?', choices=[('', 'Please select')] + choices.EXPERTISE_REGION_CHOICES, required=False, )
class AboutForm(forms.Form): error_css_class = 'input-field-container has-error' CATEGORY_CHOICES = ( 'I’m an exporter or investor, or I want to export or invest', 'I work for a trade association', 'Other') firstname = forms.CharField( label='First name', error_messages={'required': 'Enter your first name'}) lastname = forms.CharField( label='Last name', error_messages={'required': 'Enter your last name'}) jobtitle = forms.CharField( label='Job title', error_messages={'required': 'Enter your job title'}) business_type = forms.ChoiceField( label='Business type', widget=forms.RadioSelect( attrs={'id': 'checkbox-single'}, use_nice_ids=True, ), choices=((choice, choice) for choice in CATEGORY_CHOICES), error_messages={'required': 'Tell us your business type'}) other_business_type = forms.CharField( label='Tell us about your organisation', widget=TextInput(attrs={'class': 'js-field-other'}), required=False) company_name = forms.CharField( label='Business or organisation name', error_messages={ 'required': 'Enter your business or organisation name' }) email = forms.EmailField( label='Email address', error_messages={'required': 'Enter your email address'}) phone = forms.CharField( label='Telephone number', error_messages={'required': 'Enter your telephone number'}) def clean(self): data = self.cleaned_data other_business_type = data.get('other_business_type') business_type = data.get('business_type') if business_type == 'Other' and not other_business_type: self.add_error('other_business_type', 'Enter your organisation') else: return data
class FeedbackForm(SerializeDataMixin, ZendeskActionMixin, forms.Form): name = forms.CharField() email = forms.EmailField() comment = forms.CharField( label='Feedback', widget=Textarea, ) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) terms_agreed = forms.BooleanField(label=TERMS_LABEL) @property def full_name(self): assert self.is_valid() return self.cleaned_data['name']
class UserAccount(forms.Form): PASSWORD_HELP_TEXT = ( '<p>Your password must:</p>' '<ul class="list list-bullet margin-l-30-m">' '<li>be at least 10 characters</li>' '<li>have at least 1 letter</li>' '<li>have at least 1 number</li>' '<li>not contain the words which are easy to guess such as "password"' '</li>' '</ul>') MESSAGE_NOT_MATCH = "Passwords don't match" MESSAGE_PASSWORD_INVALID = 'Invalid Password' email = forms.EmailField(label='Your email address') password = forms.CharField(label='Set a password', help_text=mark_safe(PASSWORD_HELP_TEXT), widget=PasswordInput) password_confirmed = forms.CharField( label='Confirm password', widget=PasswordInput, ) captcha = ReCaptchaField( label='', label_suffix='', ) terms_agreed = forms.BooleanField(label=TERMS_LABEL) def clean_password_confirmed(self): value = self.cleaned_data['password_confirmed'] if value != self.cleaned_data['password']: raise ValidationError(self.MESSAGE_NOT_MATCH) return value def clean(self): cleaned_data = super().clean() if not self.errors: try: cleaned_data['user_details'] = helpers.create_user( email=cleaned_data['email'], password=cleaned_data['password'], ) except HTTPError as error: if error.response.status_code == 400: self.add_error('password', self.MESSAGE_PASSWORD_INVALID) else: raise return None
class UserAccount(forms.Form): PASSWORD_HELP_TEXT = ( '<p>Your password must:</p>' '<ul class="list list-bullet margin-l-30-m">' '<li>be at least 10 characters</li>' '<li>have at least 1 letter</li>' '<li>have at least 1 number</li>' '<li>not contain the words which are easy to guess such as "password"' '</li>' '</ul>' ) MESSAGE_NOT_MATCH = "Passwords don't match" email = forms.EmailField( label='Your email address' ) password = forms.CharField( label='Set a password', help_text=mark_safe(PASSWORD_HELP_TEXT), widget=PasswordInput ) password_confirmed = forms.CharField( label='Confirm password', widget=PasswordInput, ) captcha = ReCaptchaField( label='', label_suffix='', ) terms_agreed = forms.BooleanField(label=TERMS_LABEL) def clean(self): if self.data.get(self.add_prefix('remote_password_error')): self.errors.clear() raise ValidationError({'password': self.data[self.add_prefix('remote_password_error')]}) super().clean() def clean_password_confirmed(self): value = self.cleaned_data['password_confirmed'] if value != self.cleaned_data['password']: raise ValidationError(self.MESSAGE_NOT_MATCH) return value
class InternationalContactForm(FieldsMutationMixin, SerializeMixin, ZendeskActionMixin, forms.Form): first_name = forms.CharField() last_name = forms.CharField() email = forms.EmailField() organisation_type = forms.ChoiceField( label_suffix='', widget=forms.RadioSelect(), choices=COMPANY_CHOICES, ) company_name = forms.CharField() country = forms.ChoiceField( choices=[('', 'Please select')] + choices.COUNTRY_CHOICES, widget=Select(), ) city = forms.CharField() comment = forms.CharField(widget=Textarea, validators=[no_html, not_contains_url_or_email]) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
class PerfectFitProspectusForm(forms.Form): name = forms.CharField( required=True, label=_('Name'), ) company = forms.CharField( required=True, label=_('Company'), ) email = forms.EmailField( required=True, label=_('Email'), ) phone_number = forms.CharField(required=False, label=_('Phone number (optional)'), widget=TextInput(attrs={'type': 'tel'})) country = forms.ChoiceField(required=True, label=_('Country'), choices=sorted([(k, v) for k, v in COUNTRIES.items()], key=lambda tup: tup[1])) gdpr_optin = forms.BooleanField( label=_('I would like to receive further information.'), initial=False, required=False) captcha = ReCaptchaField( label='', label_suffix='', ) def __init__(self, sector_choices, country_choices, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['sector'] = forms.ChoiceField(label='Sector', choices=sector_choices) self.fields['country'] = forms.ChoiceField(label='Country', choices=country_choices)
class ExportVoucherForm(SerializeDataMixin, GovNotifyEmailActionMixin, forms.Form): company_name = forms.CharField() companies_house_number = forms.CharField( label='Companies House number', required=False, container_css_classes='js-disabled-only', ) first_name = forms.CharField(label='First name') last_name = forms.CharField(label='Last name') email = forms.EmailField() exported_to_eu = TypedChoiceField( label='Have you exported to the EU in the last 12 months?', label_suffix='', coerce=lambda x: x == 'True', choices=[(True, 'Yes'), (False, 'No')], widget=forms.RadioSelect(), required=False, ) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
class TextBoxForm(PrefixIdMixin, forms.Form): text_field1 = forms.CharField(label='Q1: Simple text field', help_text='Some help text') url_field = forms.URLField(label='Q2: URL field', help_text='Some help text') email_field = forms.EmailField( label='Q3: Email field', help_text='Some email field help text', ) choice_field = forms.ChoiceField(label='Q4: select field', help_text='Some help text', choices=[ ('red', 'Red'), ('green', 'Green'), ('blue', 'Blue'), ]) text_field2 = forms.CharField( label='Q5: Custom css class on container', help_text='Some help text', container_css_classes='border-purple border-thin padding-30', )
class AdminInviteNewAdminForm(forms.Form): MESSAGE_EMAIL_REQUIRED = 'Please select an existing collaborator or specify an email address' sso_id = forms.ChoiceField( label='', widget=forms.RadioSelect(use_nice_ids=True, ), choices=[], # set in __init__ required=False, ) collaborator_email = forms.EmailField( label='Enter the email address of the new profile administrator', required=False, ) def __init__(self, collaborator_choices, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['sso_id'].choices = collaborator_choices def clean(self): super().clean() if not self.cleaned_data.get( 'collaborator_email') and not self.cleaned_data.get('sso_id'): raise ValidationError(self.MESSAGE_EMAIL_REQUIRED)
class BaseShortForm(forms.Form): comment = forms.CharField( label='Please give us as much detail as you can', widget=Textarea, ) given_name = forms.CharField(label='First name') family_name = forms.CharField(label='Last name') email = forms.EmailField() company_type = forms.ChoiceField( label='Company type', label_suffix='', widget=forms.RadioSelect(), choices=COMPANY_TYPE_CHOICES, ) company_type_other = forms.ChoiceField( label='Type of organisation', label_suffix='', choices=(('', 'Please select'), ) + COMPANY_TYPE_OTHER_CHOICES, required=False, ) organisation_name = forms.CharField() postcode = forms.CharField() captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
class HighPotentialOpportunityForm(forms.Form): action_class = GovNotifyAction COMPANY_SIZE_CHOICES = [ ('1 - 10', '1 - 10'), ('11 - 50', '11 - 50'), ('51 - 250', '51 - 250'), ('250+', '250+'), ] REQUIRED_USER_UTM_DATA_FIELD_NAMES = ( 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', ) def __init__(self, field_attributes, opportunity_choices, utm_data=None, *args, **kwargs): for field_name, field in self.base_fields.items(): attributes = field_attributes.get(field_name) if attributes: field.__dict__.update(attributes) self.base_fields['opportunities'].choices = opportunity_choices self.utm_data = utm_data or {} # set empty string by default not exists data fields for field_name in self.REQUIRED_USER_UTM_DATA_FIELD_NAMES: self.utm_data.setdefault(field_name, '') return super().__init__(*args, **kwargs) full_name = forms.CharField() role_in_company = forms.CharField() email_address = forms.EmailField() phone_number = forms.CharField() company_name = forms.CharField() website_url = forms.CharField(required=False) country = forms.ChoiceField( choices=[('', 'Please select')] + choices.COUNTRY_CHOICES, widget=Select(attrs={'id': 'js-country-select'}), ) company_size = forms.ChoiceField(choices=COMPANY_SIZE_CHOICES) opportunities = forms.MultipleChoiceField( widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-multiple'}, use_nice_ids=True, ), choices=[] # set in __init__ ) comment = forms.CharField(widget=Textarea, required=False) terms_agreed = forms.BooleanField(label=mark_safe( 'Tick this box to accept the ' f'<a href="{urls.TERMS_AND_CONDITIONS}" target="_blank">terms and ' 'conditions</a> of the great.gov.uk service.')) captcha = ReCaptchaField( label='', label_suffix='', ) @property def serialized_data(self): formatted_opportunities = [ '• {opportunity[1]}: {opportunity[0]}'.format(opportunity=item) for item in self.base_fields['opportunities'].choices if item[0] in self.cleaned_data['opportunities'] ] return { **self.cleaned_data, **self.utm_data, 'opportunity_urls': '\n'.join(formatted_opportunities), } def send_agent_email(self, form_url): sender = Sender(email_address=self.cleaned_data['email_address'], country_code=self.cleaned_data['country']) action = self.action_class( template_id=settings.HPO_GOV_NOTIFY_AGENT_TEMPLATE_ID, email_address=settings.HPO_GOV_NOTIFY_AGENT_EMAIL_ADDRESS, form_url=form_url, sender=sender, ) response = action.save(self.serialized_data) response.raise_for_status() def send_user_email(self, form_url): # no need to set `sender` as this is just a confirmation email. action = self.action_class( template_id=settings.HPO_GOV_NOTIFY_USER_TEMPLATE_ID, email_address=self.cleaned_data['email_address'], form_url=form_url, email_reply_to_id=settings.HPO_GOV_NOTIFY_USER_REPLY_TO_ID, ) response = action.save(self.serialized_data) response.raise_for_status() def save(self, form_url): self.send_agent_email(form_url=form_url) self.send_user_email(form_url=form_url)
class EmailAddressForm(forms.Form): email_address = forms.EmailField(label='Email address')
class SaveForLaterForm(GovNotifyEmailActionMixin, forms.Form): email = forms.EmailField(label='Email address') url = forms.CharField(widget=HiddenInput(), disabled=True) expiry_timestamp = forms.CharField(widget=HiddenInput(), disabled=True)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if self.initial.get('email') is None: self.fields['email'] = forms.EmailField(label='Your email address')
class ExportSupportForm(GovNotifyEmailActionMixin, forms.Form): EMPLOYEES_NUMBER_CHOICES = ( ('1-9', '1 to 9'), ('10-49', '10 to 49'), ('50-249', '50 to 249'), ('250-499', '250 to 499'), ('500plus', 'More than 500'), ) first_name = forms.CharField( label='First name', min_length=2, max_length=50, error_messages={'required': 'Enter your first name'}) last_name = forms.CharField( label='Last name', min_length=2, max_length=50, error_messages={'required': 'Enter your last name'}) email = forms.EmailField( label='Email address', error_messages={ 'required': 'Enter an email address in the correct format, like [email protected]', 'invalid': 'Enter an email address in the correct format, like [email protected]', }) phone_number = forms.CharField( label='UK telephone number', min_length=8, help_text='This can be a landline or mobile number', error_messages={ 'max_length': 'Figures only, maximum 16 characters, minimum 8 characters excluding spaces', 'min_length': 'Figures only, maximum 16 characters, minimum 8 characters excluding spaces', 'required': 'Enter a UK phone number', 'invalid': 'Please enter a UK phone number', }) job_title = forms.CharField(label='Job title', max_length=50, error_messages={ 'required': 'Enter your job title', }) company_name = forms.CharField(label='Business name', max_length=50, error_messages={ 'required': 'Enter your business name', }) company_postcode = forms.CharField( label='Business postcode', max_length=50, error_messages={ 'required': 'Enter your business postcode', 'invalid': 'Please enter a UK postcode' }, validators=[is_valid_postcode], ) annual_turnover = forms.ChoiceField( label='Annual turnover', help_text= ('This information will help us tailor our response and advice on the services we can provide.' ), choices=(('Less than £500K', 'Less than £500K'), ('£500K to £2M', '£500K to £2M'), ('£2M to £5M', '£2M to £5M'), ('£5M to £10M', '£5M to £10M'), ('£10M to £50M', '£10M to £50M'), ('£50M or higher', '£50M or higher')), widget=forms.RadioSelect, required=False, ) employees_number = forms.ChoiceField(label='Number of employees', choices=EMPLOYEES_NUMBER_CHOICES, widget=forms.RadioSelect, error_messages={ 'required': 'Choose a number', }) currently_export = forms.ChoiceField( label='Do you currently export?', choices=(('yes', 'Yes'), ('no', 'No')), widget=forms.RadioSelect, error_messages={'required': 'Please answer this question'}) terms_agreed = forms.BooleanField( label=TERMS_LABEL, error_messages={ 'required': 'You must agree to the terms and conditions before registering', }) comment = forms.CharField( label='Please give us as much detail as you can on your enquiry', widget=Textarea, ) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) def clean_phone_number(self): phone_number = self.cleaned_data['phone_number'].replace(' ', '') if not PHONE_NUMBER_REGEX.match(phone_number): raise ValidationError('Please enter a UK phone number') return phone_number def clean_company_postcode(self): return self.cleaned_data['company_postcode'].replace(' ', '').upper() @property def serialized_data(self): data = super().serialized_data employees_number_mapping = dict(self.EMPLOYEES_NUMBER_CHOICES) data['employees_number_label'] = employees_number_mapping.get( data['employees_number']) return data
class ResendVerificationCode(forms.Form): email = forms.EmailField(label='Your email address')
class PersonalDetailsForm(forms.Form): given_name = forms.CharField(label='Given name', ) family_name = forms.CharField(label='Family name') email = forms.EmailField(label='Email address')
class CommunityJoinForm(GovNotifyEmailActionMixin, Form): name = forms.CharField( label=_('Full name'), min_length=2, max_length=50, error_messages={'required': _('Enter your full name')}) email = forms.EmailField( label=_('Email address'), error_messages={ 'required': _('Enter an email address in the correct format,' ' like [email protected]'), 'invalid': _('Enter an email address in the correct format,' ' like [email protected]'), }) phone_number_regex = re.compile(r'^(\+\d{1,3}[- ]?)?\d{8,16}$') phone_number = forms.CharField( label=_('UK telephone number'), min_length=8, help_text=_('This can be a landline or mobile number'), error_messages={ 'max_length': _('Figures only, maximum 16 characters,' ' minimum 8 characters excluding spaces'), 'min_length': _('Figures only, maximum 16 characters,' ' minimum 8 characters excluding spaces'), 'required': _('Enter an UK phone number'), 'invalid': _('Please enter an UK phone number') }) company_name = forms.CharField(label=_('Business name'), max_length=50, error_messages={ 'required': _('Enter your business name'), }) company_location = forms.CharField(label=_('Business location'), max_length=50, error_messages={ 'required': _('Enter your business location'), }) sector = forms.ChoiceField(label=_('Sector'), choices=INDUSTRY_CHOICES, error_messages={ 'required': _('Choose a sector'), }) sector_other = forms.CharField( label=_('Please specify'), widget=TextInput(attrs={'class': 'js-field-other'}), required=False, ) company_website = forms.CharField( label=_('Website'), max_length=255, help_text=_('Enter the home page address'), error_messages={ 'required': _('Enter a website address in the correct format, ' 'like https://www.example.com or www.company.com'), 'invalid': _('Enter a website address in the correct format, ' 'like https://www.example.com or www.company.com') }, required=False) employees_number = forms.ChoiceField( label=_('Number of employees'), choices=constants.EMPLOYEES_NUMBER_CHOISES, error_messages={ 'required': _('Choose a number'), }) currently_export = forms.ChoiceField( label=_('Do you currently export?'), choices=(('yes', 'Yes'), ('no', 'No')), widget=forms.RadioSelect, error_messages={'required': _('Please answer this question')}) advertising_feedback = forms.ChoiceField( label=_('Where did you hear about becoming an Export Advocate?'), choices=constants.HEARD_ABOUT_CHOISES, error_messages={ 'required': _('Please tell us where you heard about' ' becoming an Export Advocate'), }) advertising_feedback_other = forms.CharField( label=_('Please specify'), widget=TextInput(attrs={'class': 'js-field-other'}), required=False, ) terms_agreed = forms.BooleanField( label=TERMS_LABEL, error_messages={ 'required': _('You must agree to the terms and conditions' ' before registering'), }) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) def clean_phone_number(self): phone_number = self.cleaned_data.get('phone_number', '').replace(' ', '') if not self.phone_number_regex.match(phone_number): raise ValidationError(_('Please enter an UK phone number')) return phone_number def clean_employees_number(self): value = self.cleaned_data['employees_number'] self.cleaned_data[ 'employees_number_label'] = constants.EMPLOYEES_NUMBER_MAP[value] return value def clean_sector_other(self): if self.cleaned_data['sector_other']: self.cleaned_data['sector_label'] = self.cleaned_data[ 'sector_other'] return self.cleaned_data['sector_other'] def clean_advertising_feedback_other(self): if self.cleaned_data['advertising_feedback_other']: self.cleaned_data[ 'advertising_feedback_label'] = self.cleaned_data[ 'advertising_feedback_other'] return self.cleaned_data['advertising_feedback_other'] def clean(self): data = super().clean() if 'sector_label' not in data and 'sector' in data: self.cleaned_data['sector_label'] = INDUSTRY_MAP[data['sector']] if 'advertising_feedback_label' not in data and 'advertising_feedback' in data: self.cleaned_data[ 'advertising_feedback_label'] = constants.HEARD_ABOUT_MAP[ data['advertising_feedback']] return data
class UKEFContactForm(GovNotifyEmailActionMixin, forms.Form): full_name = forms.CharField( label=_('Full name'), min_length=2, max_length=50, error_messages={'required': _('Enter your full name')}) job_title = forms.CharField(label=_('Job title'), max_length=50, error_messages={ 'required': _('Enter your job title'), }) email = forms.EmailField( label=_('Business email address'), error_messages={ 'required': _('Enter an email address in the correct format,' ' like [email protected]'), 'invalid': _('Enter an email address in the correct format,' ' like [email protected]'), }) business_name = forms.CharField(label=_('Business name'), max_length=50, error_messages={ 'required': _('Enter your business name'), }) business_website = forms.CharField( label=_('Business website'), max_length=255, error_messages={ 'required': _('Enter a website address in the correct format, ' 'like https://www.example.com or www.company.com'), 'invalid': _('Enter a website address in the correct format, ' 'like https://www.example.com or www.company.com') }, required=False) country = forms.ChoiceField(label=_('Which country are you based in?'), widget=Select(), choices=COUNTRIES) like_to_discuss = forms.ChoiceField(label=_( 'Do you have a specific project or proposal you’d like to discuss?'), choices=( ('no', 'No'), ('yes', 'Yes'), ), widget=forms.RadioSelect, error_messages={ 'required': _('Please answer this question') }) like_to_discuss_other = forms.ChoiceField( label=_('Which country is the project located in?'), widget=Select(), choices=COUNTRIES, required=False) how_can_we_help = forms.CharField( label=_('How can we help?'), help_text=_( 'Please tell us briefly what type of support you’re looking for'), widget=Textarea) terms_agreed = forms.BooleanField( label=TERMS_LABEL, error_messages={ 'required': _('You must agree to the terms and conditions' ' before registering'), }) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) @property def serialized_data(self): data = super().serialized_data countries_mapping = dict(COUNTRY_CHOICES) country_label = countries_mapping.get(data['country']) data['country_label'] = country_label data['like_to_discuss_country'] = '' if data.get('like_to_discuss') == 'yes': data['like_to_discuss_country'] = countries_mapping.get( data['like_to_discuss_other']) return data
class UserAccountCollaboration(UserAccount): email = forms.EmailField( label='Your email address', disabled=True )