def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the 2 references: first reference form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(FirstReferenceForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Reference.objects.filter(application_id=self.application_id_local, reference=1).count() > 0: reference_record = Reference.objects.get( application_id=self.application_id_local, reference=1) self.fields['first_name'].initial = reference_record.first_name self.fields['last_name'].initial = reference_record.last_name self.fields['relationship'].initial = reference_record.relationship self.fields['time_known'].initial = [ reference_record.years_known, reference_record.months_known ] self.pk = reference_record.reference_id self.field_list = [ 'first_name', 'last_name', 'relationship', 'time_known' ] if ApplicantPersonalDetails.objects.filter( application_id=self.application_id_local).count() > 0: obj = ApplicantPersonalDetails.objects.get( application_id=self.application_id_local) self.birth_time = (obj.birth_year, obj.birth_month, obj.birth_day)
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the 2 references: second reference address form for manual entry :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(ReferenceSecondReferenceAddressManualForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Reference.objects.filter(application_id=self.application_id_local, reference=2).count() > 0: reference_record = Reference.objects.get( application_id=self.application_id_local, reference=2) self.fields['street_line1'].initial = reference_record.street_line1 self.fields['street_line2'].initial = reference_record.street_line2 self.fields['town'].initial = reference_record.town self.fields['county'].initial = reference_record.county self.fields['postcode'].initial = reference_record.postcode self.fields['country'].initial = reference_record.country self.pk = reference_record.reference_id self.field_list = [ 'street_line1', 'street_line2', 'town', 'county', 'postcode', 'country' ]
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: childcare address form for manual entry :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(PersonalDetailsChildcareAddressManualForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form personal_detail_id = ApplicantPersonalDetails.objects.get( application_id=self.application_id_local).personal_detail_id if ApplicantHomeAddress.objects.filter( personal_detail_id=personal_detail_id, childcare_address='True').count() > 0: childcare_address = ApplicantHomeAddress.objects.get( personal_detail_id=personal_detail_id, childcare_address='True') self.fields[ 'street_line1'].initial = childcare_address.street_line1 self.fields[ 'street_line2'].initial = childcare_address.street_line2 self.fields['town'].initial = childcare_address.town self.fields['county'].initial = childcare_address.county self.fields['postcode'].initial = childcare_address.postcode self.pk = childcare_address.home_address_id self.field_list = [ 'street_line', 'street_line2', 'town', 'county', 'postcode' ]
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: date of birth form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(PersonalDetailsDOBForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if ApplicantPersonalDetails.objects.filter( application_id=self.application_id_local).exists(): personal_details_record = ApplicantPersonalDetails.objects.get( application_id=self.application_id_local) birth_day, birth_month, birth_year = date_formatter( personal_details_record.birth_day, personal_details_record.birth_month, personal_details_record.birth_year) self.fields['date_of_birth'].initial = [ birth_day, birth_month, birth_year ] self.pk = personal_details_record.personal_detail_id self.field_list = ['date_of_birth']
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Early Years details: details form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(EYFSDetailsForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if EYFS.objects.filter( application_id=self.application_id_local).count() > 0: eyfs_record = EYFS.objects.get( application_id=self.application_id_local) self.fields[ 'eyfs_course_name'].initial = eyfs_record.eyfs_course_name course_day, course_month, course_year = date_formatter( eyfs_record.eyfs_course_date_day, eyfs_record.eyfs_course_date_month, eyfs_record.eyfs_course_date_year) self.fields['eyfs_course_date'].initial = [ course_day, course_month, course_year ] self.pk = eyfs_record.eyfs_id self.field_list = ['eyfs_course_name', 'eyfs_course_date']
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the First aid training: details form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(FirstAidTrainingDetailsForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if FirstAidTraining.objects.filter( application_id=self.application_id_local).count() > 0: first_aid_record = FirstAidTraining.objects.get( application_id=self.application_id_local) course_day, course_month, course_year = date_formatter( first_aid_record.course_day, first_aid_record.course_month, first_aid_record.course_year) self.fields[ 'first_aid_training_organisation'].initial = first_aid_record.training_organisation self.fields[ 'title_of_training_course'].initial = first_aid_record.course_title self.fields['course_date'].initial = [ course_day, course_month, course_year ] self.pk = first_aid_record.first_aid_id self.field_list = [ 'first_aid_training_organisation', 'title_of_training_course', 'course_date' ]
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Type of Childcare: Overnight form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ super(AccountSelection, self).__init__(*args, **kwargs) full_stop_stripper(self)
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the SMS code verification form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.answer = kwargs.pop('answer') super(SecurityQuestionForm, self).__init__(*args, **kwargs) full_stop_stripper(self)
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: home address form for postcode search :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') self.choices = kwargs.pop('choices') super(PersonalDetailsHomeAddressLookupForm, self).__init__(*args, **kwargs) full_stop_stripper(self) self.fields['address'].choices = self.choices
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: date of birth form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.day = kwargs.pop('day') self.month = kwargs.pop('month') self.year = kwargs.pop('year') super(SecurityDateForm, self).__init__(*args, **kwargs) full_stop_stripper(self)
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Type of childcare form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(TypeOfChildcareAgeGroupsForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if ChildcareType.objects.filter( application_id=self.application_id_local).count() > 0: childcare_record = ChildcareType.objects.get( application_id=self.application_id_local) zero_to_five_status = childcare_record.zero_to_five five_to_eight_status = childcare_record.five_to_eight eight_plus_status = childcare_record.eight_plus if (zero_to_five_status is True) & (five_to_eight_status is True) & (eight_plus_status is True): self.fields['type_of_childcare'].initial = [ '0-5', '5-8', '8over' ] elif (zero_to_five_status is True) & (five_to_eight_status is True) & (eight_plus_status is False): self.fields['type_of_childcare'].initial = ['0-5', '5-8'] elif (zero_to_five_status is True) & (five_to_eight_status is False) & (eight_plus_status is True): self.fields['type_of_childcare'].initial = ['0-5', '8over'] elif (zero_to_five_status is False) & (five_to_eight_status is True) & (eight_plus_status is True): self.fields['type_of_childcare'].initial = ['5-8', '8over'] elif (zero_to_five_status is True) & (five_to_eight_status is False) & (eight_plus_status is False): self.fields['type_of_childcare'].initial = ['0-5'] elif (zero_to_five_status is False) & (five_to_eight_status is True) & (eight_plus_status is False): self.fields['type_of_childcare'].initial = ['5-8'] elif (zero_to_five_status is False) & (five_to_eight_status is False) & (eight_plus_status is True): self.fields['type_of_childcare'].initial = ['8over'] elif (zero_to_five_status is False) & (five_to_eight_status is False) & (eight_plus_status is False): self.fields['type_of_childcare'].initial = [] self.fields['type_of_childcare'].error_messages = { 'required': 'Please select at least one age group' }
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the SMS code verification form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.magic_link_email = kwargs.pop('id') try: self.correct_sms_code = kwargs.pop('correct_sms_code') except: self.correct_sms_code = None super(VerifyPhoneForm, self).__init__(*args, **kwargs) full_stop_stripper(self)
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Declaration: declaration form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(DeclarationForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Application.objects.filter( application_id=self.application_id_local).count() > 0: share_info_declare = Application.objects.get( application_id=self.application_id_local).share_info_declare if share_info_declare is True: self.fields['share_info_declare'].initial = '1' elif share_info_declare is False: self.fields['share_info_declare'].initial = '0' display_contact_details_on_web = Application.objects.get( application_id=self.application_id_local ).display_contact_details_on_web if display_contact_details_on_web is True: self.fields['display_contact_details_on_web'].initial = '1' elif display_contact_details_on_web is False: self.fields['display_contact_details_on_web'].initial = '0' suitable_declare = Application.objects.get( application_id=self.application_id_local).suitable_declare if suitable_declare is True: self.fields['suitable_declare'].initial = '1' elif suitable_declare is False: self.fields['suitable_declare'].initial = '0' information_correct_declare = Application.objects.get( application_id=self.application_id_local ).information_correct_declare if information_correct_declare is True: self.fields['information_correct_declare'].initial = '1' elif information_correct_declare is False: self.fields['information_correct_declare'].initial = '0' change_declare = Application.objects.get( application_id=self.application_id_local).change_declare if change_declare is True: self.fields['change_declare'].initial = '1' elif change_declare is False: self.fields['change_declare'].initial = '0'
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: home address form for postcode search :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(PersonalDetailsHomeAddressForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form personal_detail_id = ApplicantPersonalDetails.objects.get( application_id=self.application_id_local).personal_detail_id if ApplicantHomeAddress.objects.filter(personal_detail_id=personal_detail_id, current_address=True).count() > 0: self.fields['postcode'].initial = ApplicantHomeAddress.objects.get(personal_detail_id=personal_detail_id, current_address=True).postcode
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the 2 references: second reference address form for postcode search :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(ReferenceSecondReferenceAddressForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Reference.objects.filter(application_id=self.application_id_local, reference=2).count() > 0: self.fields['postcode'].initial = Reference.objects.get( application_id=self.application_id_local, reference=2).postcode
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your login and contact details: additional phone form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(ContactAddPhoneForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Application.objects.filter(application_id=self.application_id_local).count() > 0: this_user = UserDetails.objects.get(application_id=self.application_id_local) login_id = this_user.login_id self.fields['add_phone_number'].initial = UserDetails.objects.get(login_id=login_id).add_phone_number self.pk = login_id self.field_list = ['add_phone_number']
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the 2 references: first reference contact details form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(ReferenceFirstReferenceContactForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if Reference.objects.filter(application_id=self.application_id_local, reference=1).count() > 0: reference_record = Reference.objects.get( application_id=self.application_id_local, reference=1) self.fields['phone_number'].initial = reference_record.phone_number self.fields['email_address'].initial = reference_record.email
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Type of Childcare: Overnight form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(TypeOfChildcareOvernightCareForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if ChildcareType.objects.filter( application_id=self.application_id_local).count() > 0: childcare_record = ChildcareType.objects.get( application_id=self.application_id_local) self.fields[ 'overnight_care'].initial = childcare_record.overnight_care self.field_list = ['overnight_care']
def __init__(self, *args, **kwargs): """ Method to configure the initialisation of the Your personal details: name form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID """ self.application_id_local = kwargs.pop('id') super(PersonalDetailsNameForm, self).__init__(*args, **kwargs) full_stop_stripper(self) # If information was previously entered, display it on the form if ApplicantPersonalDetails.objects.filter( application_id=self.application_id_local).count() > 0: personal_detail_id = ApplicantPersonalDetails.objects.get( application_id=self.application_id_local).personal_detail_id applicant_name_record = ApplicantName.objects.get( personal_detail_id=personal_detail_id) self.fields[ 'first_name'].initial = applicant_name_record.first_name self.fields[ 'middle_names'].initial = applicant_name_record.middle_names self.fields['last_name'].initial = applicant_name_record.last_name self.pk = applicant_name_record.name_id self.field_list = ['first_name', 'middle_names', 'last_name']