コード例 #1
0
 def get_context(self, contact_method=None):
     orgs = list(self.sub.organizations.not_cfa().order_by('name'))
     organization_names = [org.name for org in orgs]
     county_names = [org.county.name for org in orgs]
     counties_applied_to = oxford_comma(county_names)
     if len(county_names) > 1:
         counties_applied_to += " counties"
     else:
         counties_applied_to += " County"
     return dict(staff_name=utils.get_random_staff_name(),
                 name=namify(self.sub.answers['first_name']),
                 county_names=county_names,
                 counties_applied_to=counties_applied_to,
                 organizations=orgs,
                 organization_names=organization_names,
                 unlisted_counties=self.sub.answers.get(
                     'unlisted_counties', ''))
コード例 #2
0
 def get_context(self, contact_method=None):
     orgs = list(self.sub.organizations.all())
     orgs = utils.sort_orgs_in_default_order(orgs)
     organization_names = [org.name for org in orgs]
     county_names = [org.county.name for org in orgs]
     counties_applied_to = oxford_comma(county_names)
     if len(county_names) > 1:
         counties_applied_to += " counties"
     else:
         counties_applied_to += " County"
     return dict(
         staff_name=utils.get_random_staff_name(),
         name=namify(self.sub.answers['first_name']),
         county_names=county_names,
         counties_applied_to=counties_applied_to,
         organizations=orgs,
         organization_names=organization_names,
     )
コード例 #3
0
 def get_context(self, contact_method=None):
     orgs = list(self.sub.organizations.all())
     orgs = utils.sort_orgs_in_default_order(orgs)
     organization_names = [
         org.name for org in orgs]
     county_names = [
         org.county.name for org in orgs]
     counties_applied_to = oxford_comma(county_names)
     if len(county_names) > 1:
         counties_applied_to += " counties"
     else:
         counties_applied_to += " County"
     return dict(
         staff_name=utils.get_random_staff_name(),
         name=namify(self.sub.answers['first_name']),
         county_names=county_names,
         counties_applied_to=counties_applied_to,
         organizations=orgs,
         organization_names=organization_names,
     )
コード例 #4
0
 def get_context(self, contact_method=None):
     orgs = list(self.sub.organizations.not_cfa().order_by('name'))
     organization_names = [
         org.name for org in orgs]
     county_names = [
         org.county.name for org in orgs]
     counties_applied_to = oxford_comma(county_names)
     if len(county_names) > 1:
         counties_applied_to += " counties"
     else:
         counties_applied_to += " County"
     return dict(
         staff_name=utils.get_random_staff_name(),
         name=namify(self.sub.answers['first_name']),
         county_names=county_names,
         counties_applied_to=counties_applied_to,
         organizations=orgs,
         organization_names=organization_names,
         unlisted_counties=self.sub.answers.get('unlisted_counties', '')
     )
コード例 #5
0
 def get_full_name(self):
     return '{first_name} {last_name}'.format(
         **{
             key: namify(self.answers.get(key))
             for key in ['first_name', 'last_name']
         })
コード例 #6
0
 'Cell phone number':
 'phone_number',
 'Charged with a crime':
 lambda s: yesno(s, 'being_charged'),
 'Date':
 lambda s: s.get_local_date_received('%-m/%-d/%Y'),
 'Date of Birth':
 get_formatted_dob,
 'Dates arrested outside SF':
 'when_where_outside_sf',
 'Email Address':
 'email',
 'Employed':
 lambda s: yesno(s, 'currently_employed'),
 'First Name':
 lambda s: namify(s.answers['first_name']),
 'Home phone number':
 '',
 'How did you hear about the Clean Slate Program':
 'how_did_you_hear',
 'If probation where and when?':
 lambda s: '{} {}'.format(s.answers.get('where_probation_or_parole'),
                          s.answers.get('when_probation_or_parole')),
 'Last Name':
 lambda s: namify(s.answers['last_name']),
 'MI':
 lambda s: s.answers.get('middle_name', '')[:1],
 'May we leave voicemail':
 lambda s: yesno(s),
 'May we send mail here':
 lambda s: yesno(s),
コード例 #7
0
ファイル: fields.py プロジェクト: pamdinevaCfA/intake
 def get_display_value(self):
     return namify(self.get_current_value())
コード例 #8
0
ファイル: clean_slate.py プロジェクト: spencerhitch/intake
# Structure and naming
# in tests
translator = ClearMyRecordFormToPDFTranslator({
            'Address City': 'address_city',
            'Address State': 'address_state',
            'Address Street': 'address_street',
            'Address Zip': 'address_zip',
            'Arrested outside SF': lambda s: yesno(s, 'rap_outside_sf'),
            'Cell phone number': 'phone_number',
            'Charged with a crime': lambda s: yesno(s, 'being_charged'),
            'Date': lambda s: s.get_local_date_received('%-m/%-d/%Y'),
            'Date of Birth': get_formatted_dob,
            'Dates arrested outside SF': 'when_where_outside_sf',
            'Email Address': 'email',
            'Employed': lambda s: yesno(s, 'currently_employed'),
            'First Name': lambda s: namify(s.answers['first_name']),
            'Home phone number': '',
            'How did you hear about the Clean Slate Program': 'how_did_you_hear',
            'If probation where and when?': lambda s: '{} {}'.format(
                s.answers.get('where_probation_or_parole'),
                s.answers.get('when_probation_or_parole')),
            'Last Name': lambda s: namify(s.answers['last_name']),
            'MI': lambda s: s.answers.get('middle_name', '')[:1],
            'May we leave voicemail': lambda s: yesno(s),
            'May we send mail here': lambda s: yesno(s),
            'Monthly expenses': 'monthly_expenses',
            'On probation or parole': lambda s: yesno(s, 'on_probation_parole'),
            'Other phone number': '',
            'Serving a sentence': lambda s: yesno(s, 'serving_sentence'),
            'Social Security Number': lambda s: fmt_ssn(s, ''),
            'US Citizen': lambda s: yesno(s, 'us_citizen'),
コード例 #9
0
ファイル: fields.py プロジェクト: pamdinevaCfA/intake
 def get_display_value(self):
     return namify(self.get_current_value())
コード例 #10
0
ファイル: clean_slate.py プロジェクト: pamdinevaCfA/intake
# Structure and naming
# in tests
translator = ClearMyRecordFormToPDFTranslator({
    'Address City': 'address_city',
    'Address State': 'address_state',
    'Address Street': 'address_street',
    'Address Zip': 'address_zip',
    'Arrested outside SF': lambda s: yesno(s, 'rap_outside_sf'),
    'Cell phone number': 'phone_number',
    'Charged with a crime': lambda s: yesno(s, 'being_charged'),
    'Date': lambda s: s.get_local_date_received('%-m/%-d/%Y'),
    'Date of Birth': get_formatted_dob,
    'Dates arrested outside SF': 'when_where_outside_sf',
    'Email Address': 'email',
    'Employed': lambda s: yesno(s, 'currently_employed'),
    'First Name': lambda s: namify(s.answers.get('first_name', '')),
    'Home phone number': '',
    'How did you hear about the Clear My Record Program': 'how_did_you_hear',
    'If probation where and when?': lambda s: '{} {}'.format(
        s.answers.get('where_probation_or_parole'),
        s.answers.get('when_probation_or_parole')),
    'Last Name': lambda s: namify(s.answers.get('last_name', '')),
    'MI': lambda s: s.answers.get('middle_name', '')[:1],
    'May we leave voicemail': lambda s: yesno(s),
    'May we send mail here': lambda s: yesno(s),
    'Monthly expenses': 'monthly_expenses',
    'On probation or parole': lambda s: yesno(s, 'on_probation_parole'),
    'Other phone number': '',
    'Serving a sentence': lambda s: yesno(s, 'serving_sentence'),
    'Social Security Number': lambda s: fmt_ssn(s, ''),
    'US Citizen': lambda s: yesno(s, 'us_citizen'),
コード例 #11
0
 'Cell phone number':
 'phone_number',
 'Charged with a crime':
 lambda s: yesno(s, 'being_charged'),
 'Date':
 lambda s: s.get_local_date_received('%-m/%-d/%Y'),
 'Date of Birth':
 get_formatted_dob,
 'Dates arrested outside SF':
 'when_where_outside_sf',
 'Email Address':
 'email',
 'Employed':
 lambda s: yesno(s, 'currently_employed'),
 'First Name':
 lambda s: namify(s.answers.get('first_name', '')),
 'Home phone number':
 '',
 'How did you hear about the Clear My Record Program':
 'how_did_you_hear',
 'If probation where and when?':
 lambda s: '{} {}'.format(s.answers.get('where_probation_or_parole'),
                          s.answers.get('when_probation_or_parole')),
 'Last Name':
 lambda s: namify(s.answers.get('last_name', '')),
 'MI':
 lambda s: s.answers.get('middle_name', '')[:1],
 'May we leave voicemail':
 lambda s: yesno(s),
 'May we send mail here':
 lambda s: yesno(s),