示例#1
0
 def _set_fields(self, form):
     setattr(
         form, 'language',
         SelectField(_(u'Language'),
                     choices=util.get_all_profile_languages()))
     setattr(
         form, 'email',
         TextField(
             _(u'Prospect Email'),
             [validators.Length(min=2, message=_(u'Email required.'))]))
     setattr(form, 'phone', TextField(_(u'Phone')))
     setattr(
         form, 'first_name',
         TextField(
             _(u'First Name'),
             [validators.Length(min=2, message=_(u'Email required.'))]))
     setattr(
         form, 'last_name',
         TextField(
             _(u'Last Name'),
             [validators.Length(min=2, message=_(u'Email required.'))]))
     setattr(
         form, 'category',
         SelectField(
             _(u'Category'),
             choices=util.get_all_categories_for_profile_editing(
                 self.domain),
             validators=[
                 custom_validators.DisallowNoChoiceInSelect(message=_(
                     'Please choose an option from the list. If none of the options seems to fit, please choose "Other"'
                 ))
             ]))
示例#2
0
 def _set_fields(self, form):        
     setattr(form, 'specialty', SelectField(_(u'Specialty'), 
                                                 choices=util.get_all_specialties_for_form(self.domain),
                                                 validators=[custom_validators.DisallowNoChoiceInSelect(message=_('Please choose an option from the list. If none of the options seems to fit, please choose "Other" and write in the field below.'))]
                                         ))
     setattr(form, 'other', TextField(_(u'Other'), 
                                      description=_(u'Please enter the specialty name here if not in the list'),
                                      validators=[custom_validators.RequiredIfOther('specialty', message=_('Please enter a specialty name'))]
                                 ))
示例#3
0
 def _set_fields(self, form):        
     setattr(form, 'certification', SelectField(_(u'Certification Title'), 
                                                 choices=util.get_all_certifications_for_form(self.domain),
                                                 validators=[custom_validators.DisallowNoChoiceInSelect(message=_('Please choose an option from the list. If none of the options seems to fit, please choose "Other" and write in the field below.'))]
                                         ))
     setattr(form, 'other', TextField(_(u'Other'), 
                                      description=_(u'Please enter the certificate name here if not in the list'),
                                      validators=[custom_validators.RequiredIfOther('certification', message=_('Please enter a certificate name'))]
                                 ))
     setattr(form, 'year', IntegerField(_(u'Year Obtained'), [validators.NumberRange(min=1940, max=2100, message=_(u'Please enter a valid year.'))]))
示例#4
0
 def _set_fields(self, form):        
     setattr(form, 'organization', SelectField(_(u'Organization Name'), 
                                               choices=util.get_all_organizations_for_form(self.domain),
                                               validators=[custom_validators.DisallowNoChoiceInSelect(message=_('Please choose an option from the list. If none of the options seems to fit, please choose "Other" and write in the field below.'))]
                                         ))
     setattr(form, 'other', TextField(_(u'Other'), 
                                      description=_(u'Please enter the organization name here if not in the list'),
                                      validators=[custom_validators.RequiredIfOther('organization', message=_('Please enter an organization name'))]
                                 ))
     
     setattr(form, 'start_year', IntegerField(_(u'Start Year'), [validators.NumberRange(min=1940, max=2100, message=_(u'Please enter a valid year.'))]))
     setattr(form, 'end_year', IntegerField(_(u'End Year'), description=_(u'Leave empty for present'), 
                                             validators=[validators.NumberRange(min=1940, max=2100, message=_(u'Please enter a valid year.')), validators.Optional()]))