class FeedbackForm(SaveOnlyInDatabaseAPIForm): result_found = forms.ChoiceField( label='Did you find what you were looking for on the site today?', widget=forms.RadioSelect(), choices=[('yes', 'Yes'), ('no', 'No')]) search_target = forms.CharField( label= 'Whether yes or no, please let us know what you were searching for', widget=Textarea(attrs={ 'rows': 4, 'cols': 15 })) from_search_query = forms.CharField(widget=HiddenInput(), required=False) from_search_page = IntegerField(widget=HiddenInput(), required=False) contactable = forms.ChoiceField( label= 'May we contact you with some brief follow-up questions on your experience?', widget=forms.RadioSelect(), choices=[('yes', 'Yes'), ('no', 'No')]) contact_name = forms.CharField(label='What is your name?', required=False) contact_email = forms.EmailField(label='What is your email address?', required=False) contact_number = forms.CharField( label='What is your phone number? (optional)', required=False) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) @property def serialized_data(self): if 'captcha' in self.cleaned_data: del self.cleaned_data['captcha'] return self.cleaned_data
class CompaniesHouseBusinessDetailsForm(forms.Form): company_name = forms.CharField(label='Registered company name') company_number = forms.CharField( required=False, container_css_classes= 'border-active-blue read-only-input-container js-disabled-only') sector = forms.ChoiceField( label='Which industry are you in?', choices=INDUSTRY_CHOICES, container_css_classes='govuk-!-margin-top-6 govuk-!-margin-bottom-6', ) percentage_uk_market = forms.CharField( label= 'What percentage of the total UK market do your sales represent? (optional)', required=False, ) employees = forms.ChoiceField( label='Number of employees', choices=choices.EMPLOYEES, required=False, widget=forms.RadioSelect(), ) turnover = forms.ChoiceField( label='Annual turnover for 2018-2019', choices=TURNOVER_CHOICES, required=False, widget=forms.RadioSelect(), )
class CompaniesHouseBusinessDetailsForm(forms.Form): name = forms.CharField(label='Trading name') number = forms.CharField(disabled=True, ) date_of_creation = forms.DateField( label='Incorporated on', input_formats=['%d %B %Y'], disabled=True, required=False, ) address = forms.CharField( disabled=True, required=False, ) website = forms.URLField( label='Business URL (optional)', help_text='The website address must start with http:// or https://', required=False, ) employees = forms.ChoiceField( choices=EMPLOYEES_CHOICES, label='How many employees are in your business?', ) sectors = forms.ChoiceField( label='What industry is your business in?', choices=INDUSTRY_CHOICES, ) def clean_sectors(self): return [self.cleaned_data['sectors']] def clean(self): super().clean() self.cleaned_data.pop('clean_number', None) self.cleaned_data.pop('date_of_creation', None)
class RadioForm(PrefixIdMixin, forms.Form): radio = forms.ChoiceField( label='Q1: Radio select', label_suffix='', help_text='Some help text.', widget=forms.RadioSelect(use_nice_ids=True, attrs={'id': 'radio-one'}), choices=( (True, 'Yes'), (False, 'No'), )) radio_group = forms.ChoiceField( label='Q2: Radio select with option groups', label_suffix='', help_text='Some help text.', widget=forms.RadioSelect(use_nice_ids=True, attrs={'id': 'radio-two'}), choices=( ('Colours', ( ('red', 'Red'), ('green', 'Green'), ('blue', 'Blue'), )), ('Numbers', ( ('4', 'Four'), ('5', 'Five'), ('6', 'Six'), )), ))
class BusinessDetailsForm(fields.BindNestedFormMixin, forms.Form): company_type = forms.ChoiceField( label='Company type', label_suffix='', widget=forms.RadioSelect(), choices=COMPANY_TYPE_CHOICES, ) company_name = forms.CharField(label='Company name') company_number = forms.CharField( required=False, container_css_classes='form-group js-disabled-only') sector = forms.ChoiceField( label='Which industry are you in?', choices=INDUSTRY_CHOICES, ) employees = forms.ChoiceField( label='Number of employees', choices=(('', 'Please select'), ) + choices.EMPLOYEES, required=False, ) turnover = forms.ChoiceField( label='Annual turnover for 2018-19', choices=TURNOVER_CHOICES, required=False, ) employment_regions = fields.MultipleChoiceAutocomplateField( label='Where do you employ the most people?', choices=choices.EXPERTISE_REGION_CHOICES, )
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 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 BusinessDetailsForm(ConsentFieldMixin, forms.Form): TURNOVER_OPTIONS = (('', 'Please select'), ('0-25k', 'under £25,000'), ('25k-100k', '£25,000 - £100,000'), ('100k-1m', '£100,000 - £1,000,000'), ('1m-5m', '£1,000,000 - £5,000,000'), ('5m-25m', '£5,000,000 - £25,000,000'), ('25m-50m', '£25,000,000 - £50,000,000'), ('50m+', '£50,000,000+')) company_type = forms.ChoiceField( label_suffix='', widget=forms.RadioSelect(), choices=COMPANY_TYPE_CHOICES, ) companies_house_number = forms.CharField( label='Companies House number', required=False, ) company_type_other = forms.ChoiceField( label_suffix='', choices=(('', 'Please select'), ) + COMPANY_TYPE_OTHER_CHOICES, required=False, ) organisation_name = forms.CharField() postcode = forms.CharField() industry = forms.ChoiceField(choices=INDUSTRY_CHOICES) industry_other = forms.CharField( label='Type in your industry', widget=TextInput(attrs={'class': 'js-field-other'}), required=False, ) turnover = forms.ChoiceField( label='Annual turnover (optional)', choices=TURNOVER_OPTIONS, required=False, ) employees = forms.ChoiceField( label='Number of employees (optional)', choices=(('', 'Please select'), ) + choices.EMPLOYEES, required=False, ) captcha = ReCaptchaField(label='', label_suffix='', widget=ReCaptchaV3()) def clean_industry(self): industry = self.cleaned_data['industry'] self.cleaned_data['industry_label'] = INDUSTRY_MAP[industry] return industry
class SellingOnlineOverseasApplicantNonCH(forms.Form): company_name = forms.CharField( label='Company name', disabled=True, required=False, container_css_classes='border-active-blue read-only-input-container', ) company_address = forms.CharField( label='Address', disabled=True, required=False, container_css_classes= 'border-active-blue read-only-input-container padding-bottom-0 margin-bottom-30', ) website_address = forms.CharField( label='Your business web address', help_text='Website address, where we can see your products online.', max_length=255, ) turnover = forms.ChoiceField( label='Your business turnover last year', help_text=( 'You may use 12 months rolling or last year\'s annual turnover.'), choices=SOO_TURNOVER_OPTIONS, widget=forms.RadioSelect(), )
class AdminInviteCollaboratorForm(forms.Form): collaborator_email = forms.EmailField( label='Email address of collaborator', required=False, ) role = forms.ChoiceField(choices=USER_ROLE_CHOICES, container_css_classes='width-half')
class BusinessDetailsDevelopingCountryForm(forms.Form): company_name = forms.CharField(label='Company name') sector = forms.ChoiceField( label='Which industry are you in?', choices=INDUSTRY_CHOICES, ) employees = forms.ChoiceField( label='Number of employees', choices=choices.EMPLOYEES, required=False, ) turnover = forms.ChoiceField( label='Annual turnover for 2018-19', choices=TURNOVER_CHOICES, required=False, )
class AdminCollaboratorEditForm(forms.Form): CHOICES = { user_roles.MEMBER: [ ('', 'Please select'), (CHANGE_COLLABORATOR_TO_ADMIN, 'Upgrade to Admin'), (REMOVE_COLLABORATOR, 'Remove'), ], user_roles.EDITOR: [ ('', 'Please select'), (CHANGE_COLLABORATOR_TO_ADMIN, 'Upgrade to Admin'), (CHANGE_COLLABORATOR_TO_MEMBER, 'Downgrade to Member'), (REMOVE_COLLABORATOR, 'Remove'), ], user_roles.ADMIN: [ ('', 'Please select'), (CHANGE_COLLABORATOR_TO_MEMBER, 'Downgrade to Member'), (REMOVE_COLLABORATOR, 'Remove'), ] } def __init__(self, current_role, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['action'].choices = self.CHOICES[current_role] action = forms.ChoiceField( label='', choices=[] # set in __init__ )
class NonCompaniesHouseSearch(forms.Form): MESSAGE_INVALID_ADDRESS = 'Address should be at least two lines.' COMPANY_TYPES = [ ('', 'Please select'), ] + [(value, label) for value, label in choices.COMPANY_TYPES if value != 'COMPANIES_HOUSE'] company_type = forms.ChoiceField(label='Business category', choices=COMPANY_TYPES) company_name = forms.CharField(label='Business name') postal_code = forms.CharField( label='Business postcode', widget=PostcodeInput, required=False, ) address = forms.CharField( help_text='Type your business address', widget=Textarea(attrs={'rows': 4}), required=False, ) sectors = forms.ChoiceField( label='What industry is your business in?', choices=INDUSTRY_CHOICES, ) website = forms.URLField( label='What\'s your business web address (optional)', help_text='The website address must start with http:// or https://', required=False, ) def clean_sectors(self): return [self.cleaned_data['sectors']] def clean_address(self): value = self.cleaned_data['address'].strip().replace(', ', '\n') parts = value.split('\n') postal_code = self.cleaned_data.get('postal_code', '') if value.count('\n') == 0: raise ValidationError(self.MESSAGE_INVALID_ADDRESS) if postal_code not in value: value = f'{value}\n{postal_code}' self.cleaned_data['address_line_1'] = parts[0].strip() self.cleaned_data['address_line_2'] = parts[1].strip() return value
class ImportedProductsUsageDetailsForm(forms.Form): imported_good_sector = forms.ChoiceField( label='Industry of product or service', choices=[('', 'Please select')] + choices.SECTORS, ) imported_good_sector_details = forms.CharField( label="Description of products or service", widget=Textarea(attrs={'rows': 6}), )
class ConsumerTypeForm(forms.Form): consumer_type = forms.ChoiceField( label='', choices=( (constants.CONSUMER_GROUP, 'Consumer group'), (constants.INDIVIDUAL_CONSUMER, 'Individual consumer'), ), widget=forms.RadioSelect(), )
class OutcomeForm(forms.Form): CHOICES = (('INCREASE', "I want an increase in the tariff rate"), ('DECREASE', "I want a decrease in the tariff rate"), ('QUOTA_CHANGE', "I want the tariff quote changed"), ('OTHER', 'Other')) outcome = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
class OutcomeForm(fields.BindNestedFormMixin, forms.Form): tariff_rate = forms.ChoiceField( label='Tariff rate change', choices=[ (constants.INCREASE, 'I want the tariff rate increased'), (constants.DECREASE, 'I want the tariff rate decreased'), ('N/A', 'I want neither'), ], widget=forms.RadioSelect(), ) tariff_quota = forms.ChoiceField( label='Tariff quota change', choices=[ (constants.INCREASE, 'I want the tariff quota increased '), (constants.DECREASE, 'I want the tariff quota decreased'), ('N/A', 'I want neither'), ], widget=forms.RadioSelect(), )
class LocationRoutingForm(forms.Form): CHOICES = ( (constants.DOMESTIC, 'The UK'), (constants.INTERNATIONAL, 'Outside the UK'), ) choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
class InternationalRoutingForm(forms.Form): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['choice'].choices = international_choices() choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=[], # array overridden by constructor )
class GreatAccountRoutingForm(forms.Form): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['choice'].choices = great_account_choices() choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=[], # array overridden by constructor )
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 LocationRoutingForm(forms.Form): CHOICES = ( (constants.UK_BUSINESS, "I'm a UK business importing from overseas"), (constants.UK_CONSUMER, "I'm a UK consumer or consumer group"), (constants.FOREIGN, "I'm an exporter from a developed country"), ) choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
class OpportunitySearchForm(forms.Form): sector = forms.ChoiceField(label=_('sector'), widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-sector'}, use_nice_ids=True, ), required=False) scale = forms.ChoiceField(label=_('scale'), widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-scale'}, use_nice_ids=True, ), required=False) region = forms.ChoiceField(label=_('region'), widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-region'}, use_nice_ids=True, ), required=False) sub_sector = forms.ChoiceField( label=_('sub_sector'), widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-sub_sector'}, use_nice_ids=True, ), required=False) sort_by = forms.ChoiceField( label=_('sort_by'), widget=Select(attrs={'onchange': 'this.form.submit()'}), required=False, ) def __init__(self, sectors, scales, regions, sort_by_options, sub_sectors, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['sector'].choices = sectors self.fields['scale'].choices = scales self.fields['region'].choices = regions self.fields['sort_by'].choices = sort_by_options self.fields['sub_sector'].choices = sub_sectors
class ExportOpportunitiesRoutingForm(forms.Form): CHOICES = ( (constants.NO_RESPONSE, 'I haven\'t had a response from the opportunity I applied for'), (constants.ALERTS, 'My daily alerts are not relevant to me'), (constants.OTHER, 'Other'), ) choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
class GreatServicesRoutingForm(forms.Form): CHOICES = ( (constants.EXPORT_OPPORTUNITIES, 'Export opportunities service'), (constants.GREAT_ACCOUNT, 'Your account on great.gov.uk'), (constants.OTHER, 'Other'), ) choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
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 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 CaseStudyBasicInfoForm(forms.Form): title = forms.CharField( label='Title of your case study or project', max_length=60, validators=[directory_validators.company.no_html], ) short_summary = forms.CharField( label='Summary of your case study or project', help_text=( 'Summarise your case study in 200 characters or fewer. This will' ' appear on your main business profile page.'), max_length=200, validators=[ validators.does_not_contain_email, directory_validators.company.no_html, ], widget=Textarea, ) description = forms.CharField( label='Describe your case study or project', help_text=('Describe your project or case study in greater detail. ' 'You have up to 1,000 characters to use.'), max_length=1000, validators=[ validators.does_not_contain_email, directory_validators.company.no_html, ], widget=Textarea, ) sector = forms.ChoiceField( label='Industry most relevant to your case study or project', choices=INDUSTRY_CHOICES) website = forms.URLField( label='The web address for your case study or project (optional)', help_text='Enter a full URL including http:// or https://', max_length=255, required=False, ) keywords = forms.CharField( label=('Enter up to 10 keywords that describe your case ' 'study or project. Keywords should be separated by ' 'commas.'), help_text=('These keywords will help potential overseas buyers ' 'find your case study.'), max_length=1000, widget=Textarea, validators=[ directory_validators.company.keywords_word_limit, directory_validators.company.keywords_special_characters, directory_validators.company.no_html, ])
class RoutingUserTypeForm(forms.Form): CHOICES = ( (constants.UK_BUSINESS, "As a UK business or trade organisation"), (constants.UK_CONSUMER, "As a UK consumer or consumer representative"), (constants.DEVELOPING_COUNTRY_COMPANY, ("As an exporter, or representative, from a developing country eligible" " for the Generalised Scheme of Preferences (GSP) or with an Economic Partnership" " Agreement (EPA) with the UK.")), ) choice = forms.ChoiceField( label='', widget=forms.RadioSelect(), choices=CHOICES, )
class NonCompaniesHouseBusinessDetailsForm(forms.Form): name = forms.CharField(label='Trading name') address_line_1 = forms.CharField(required=False, ) address_line_2 = forms.CharField(required=False, ) locality = forms.CharField(required=False, ) postal_code = forms.CharField(required=False, ) website_address = forms.URLField( label='Business URL (optional)', help_text='The website address must start with http:// or https://', required=False, ) employees = forms.ChoiceField( choices=EMPLOYEES_CHOICES, label='How many employees are in your business?', ) sectors = forms.ChoiceField( label='Which industry is your business in?', choices=INDUSTRY_CHOICES, ) def clean_sectors(self): return [self.cleaned_data['sectors']]