class SummaryForm(forms.Form): contact_by_email = forms.BooleanField( label='I would like to receive additional information by email', required=False, ) contact_by_phone = forms.BooleanField( label='I would like to receive additional information by telephone', required=False, )
class PersonalDetails(forms.Form): given_name = forms.CharField(label='First name', ) family_name = forms.CharField(label='Last name', ) job_title = forms.CharField() phone_number = forms.CharField(label='Phone number (optional)', required=False) confirmed_is_company_representative = forms.BooleanField( label=('I confirm that I have the right to act for this business. I ' 'understand that great.gov.uk might write to this business to ' 'confirm I can create an account.')) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
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 SellingOnlineOverseasContactDetails(forms.Form): contact_first_name = forms.CharField( label='First name', disabled=True, required=False, container_css_classes='border-active-blue read-only-input-container', ) contact_last_name = forms.CharField( label='Last name', disabled=True, required=False, container_css_classes='border-active-blue read-only-input-container', ) contact_email = forms.EmailField( label='Your email', disabled=True, required=False, container_css_classes= 'border-active-blue read-only-input-container padding-bottom-0 margin-bottom-30', ) phone = forms.CharField(label='Phone number', ) email_pref = forms.BooleanField( label='I prefer to be contacted by email', required=False, )
class SellingOnlineOverseasContactDetails(forms.Form): contact_first_name = forms.CharField(label='First name', ) contact_last_name = forms.CharField(label='Last name', ) contact_email = forms.EmailField( label='Your email', disabled=True, required=False, container_css_classes= 'border-active-blue read-only-input-container padding-bottom-0 margin-bottom-30', ) phone = forms.CharField(label='Phone number', ) email_pref = forms.BooleanField( label='I prefer to be contacted by email', required=False, ) def _set_name_field_editability(self): # If cetain fields lack content, allow each one to be editable. for fieldname in [ 'contact_first_name', 'contact_last_name', ]: if self.initial.get(fieldname): self.fields[fieldname].required = False self.fields[fieldname].disabled = True # note that we can't set .container_css_classes, but we can do this: self.fields[ fieldname]._container_css_classes = 'border-active-blue read-only-input-container' else: self.fields[fieldname].required = True self.fields[fieldname].disabled = False def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._set_name_field_editability()
class SummaryForm(forms.Form): captcha = ReCaptchaField( label='', label_suffix='', container_css_classes='govuk-!-margin-top-6 govuk-!-margin-bottom-6', ) terms_agreed = forms.BooleanField(label=TERMS_LABEL)
class CheckboxForm(PrefixIdMixin, forms.Form): checkbox1 = forms.BooleanField( label='Q1: Label text', help_text=( 'This is some help text. This help text is very long so ' 'you can see how it wraps next to the form elements. Very very ' 'long boring text that doesn\'t say anything. Why are you ' 'reading this?'), widget=forms.CheckboxWithInlineLabel(attrs={'id': 'checkbox-one'})) checkbox2 = forms.BooleanField( label='Q2: Label text with no help text', widget=forms.CheckboxWithInlineLabel(attrs={'id': 'checkbox-two'})) checkbox3 = forms.BooleanField( label='Q3: Example of small checkbox', widget=forms.CheckboxWithInlineLabel(attrs={'id': 'checkbox-three'}), container_css_classes='checkbox-small', )
class PublishForm(forms.Form): LABEL_UNPUBLISH_FAS = 'Untick to remove your profile from this service' LABEL_UNPUBLISH_ISD = 'Untick the box to cancel publication' LABEL_ISD = 'Ready to publish on UK Investment Support Directory' LABEL_FAS = 'Publish profile on great.gov.uk/trade/' is_published_investment_support_directory = forms.BooleanField( label=LABEL_ISD, required=False) is_published_find_a_supplier = forms.BooleanField(label=LABEL_FAS, required=False) def __init__(self, company, *args, **kwargs): super().__init__(*args, **kwargs) if company.get('is_published_investment_support_directory'): field = self.fields['is_published_investment_support_directory'] field.widget.label = self.LABEL_UNPUBLISH_ISD if company.get('is_published_find_a_supplier'): field = self.fields['is_published_find_a_supplier'] field.widget.label = self.LABEL_UNPUBLISH_FAS
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 DemoFormErrors(PrefixIdMixin, forms.Form): text_field1 = forms.CharField(label='Simple text field', help_text='Some help text', required=True) checkbox1 = forms.BooleanField( label='Label text', required=True, help_text=('Some help text.'), widget=forms.CheckboxWithInlineLabel(attrs={'id': 'checkbox-one'})) multiple_choice = forms.MultipleChoiceField( label='Multiple choice checkboxes', required=True, help_text='Some help text.', widget=forms.CheckboxSelectInlineLabelMultiple( attrs={'id': 'checkbox-multiple'}, use_nice_ids=True, ), choices=( ('red', 'Red'), ('green', 'Green'), ('blue', 'Blue'), ), ) radio = forms.ChoiceField( label='Radio select', required=True, label_suffix='', help_text='Some help text.', widget=forms.RadioSelect(use_nice_ids=True, attrs={'id': 'radio-one'}), choices=( (True, 'Yes'), (False, 'No'), )) def clean(self, *args, **kwargs): self.add_error( field=None, error=['Some non-field error', 'Some other non-field error']) super().clean(*args, **kwargs)
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 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 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 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 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 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)
def __init__(self, ask_terms_agreed=False, *args, **kwargs): super().__init__(*args, **kwargs) if ask_terms_agreed: self.fields['terms_agreed'] = forms.BooleanField(label=TERMS_LABEL)