コード例 #1
0
ファイル: fields.py プロジェクト: Razin-Tailor/ChatterBot
 def populate_obj(self, obj, name):
     if self.data:
         try:
             if getattr(obj, name) is None:
                 setattr(obj, name, self.form.Meta.model())
         except AttributeError:
             pass
     FormField.populate_obj(self, obj, name)
コード例 #2
0
ファイル: fields.py プロジェクト: cluck/wtforms-alchemy
 def __init__(self, label=None, validators=None, separator='-', **kwargs):
     FormField.__init__(
         self,
         DateTimeForm,
         label=label,
         validators=validators,
         separator=separator,
         **kwargs
     )
コード例 #3
0
 def __init__(self, label=None, validators=None, separator='-', **kwargs):
     FormField.__init__(
         self,
         datetime_form(kwargs.pop('datetime_form', {})),
         label=label,
         validators=validators,
         separator=separator,
         **kwargs
     )
コード例 #4
0
ファイル: fields.py プロジェクト: cluck/wtforms-alchemy
 def process(self, formdata, data=_unset_value):
     if data is _unset_value:
         try:
             data = self.default()
         except TypeError:
             data = self.default
     if data:
         obj = Date()
         obj.date = data.date()
         obj.time = data.time()
     else:
         obj = None
     FormField.process(self, formdata, data=obj)
コード例 #5
0
    def populate_obj(self, obj, name):
        if has_identity(obj):
            sess = session(obj)
            item = getattr(obj, name, None)
            if item:
                # only delete persistent objects
                if has_identity(item):
                    sess.delete(item)
                elif item in sess:
                    sess.expunge(item)
                setattr(obj, name, None)

        if self.data:
            setattr(obj, name, self.form.Meta.model())

        FormField.populate_obj(self, obj, name)
コード例 #6
0
ファイル: forms.py プロジェクト: pyeu/maps4all
class DetermineOptionsForm(Form):
    navigation = FormField(NavigationForm)
コード例 #7
0
        class EventForm(ModelForm):
            class Meta:
                model = self.Event

            locations = ModelFieldList(FormField(LocationForm),
                                       population_strategy='update')
コード例 #8
0
ファイル: forms.py プロジェクト: pyeu/maps4all
class RequiredOptionDescriptorMissingForm(Form):
    resources = FieldList(SelectMultipleField(validators=[InputRequired()]))
    navigation = FormField(NavigationForm)
コード例 #9
0
 class TemplateForm(AddTemplateForm):
     body = FormField(TemplateBodyFieldForm)
     base_template = SelectField('Base Template',
                                 choices=fix_choices(
                                     BaseConfig.BASE_TEMPLATE_FILES))
コード例 #10
0
 class StaticBlockForm(form):
     content = FormField(TextEditorFieldForm, '_')
コード例 #11
0
ファイル: forms.py プロジェクト: raylite/auto_label
class PublicationsForm(FlaskForm):
    title = StringField('Publications', render_kw={'readonly': True})
    articles = FieldList(FormField(ArticleForm))  #
コード例 #12
0
ファイル: form.py プロジェクト: ccianos/wazo-ui
class GroupForm(BaseForm):
    name = StringField(l_('Name'), validators=[InputRequired()])
    members = FormField(MembersForm)
    tenant_uuid = SelectField(l_('Tenant'), choices=[])
    tenant = FormField(TenantUuidForm)
    submit = SubmitField()
コード例 #13
0
 class ListForm(SubForm):
     entry = FieldList(FormField(MapForm),
                       min_entries=min_entries,
                       max_entries=max_entries)
     upload = FileField(upload_label)
コード例 #14
0
ファイル: forms.py プロジェクト: keaglem/trivia_manager
class QuestionForm(Form):
    prompts = FieldList(FormField(PromptForm),
                        label='Questions',
                        min_entries=1)
    submit = SubmitField('Submit')
コード例 #15
0
ファイル: form.py プロジェクト: wazo-platform/wazo-ui
class MembersForm(BaseForm):
    user_uuids = SelectMultipleField(l_('Members'), choices=[])
    users = FieldList(FormField(UserForm))
コード例 #16
0
class Laborator(ModelFormMeta):
    class Meta:
        model = LaboratorForm

    Students = ModelFieldList(FormField(StudentForm))
コード例 #17
0
class IvrForm(BaseForm):
    name = StringField(l_('Name'),
                       validators=[InputRequired(),
                                   Length(max=128)])
    abort_destination = DestinationField(
        destination_label=l_('Abort destination'),
        description=l_(
            'The destination to redirect the caller to when the maximum number of tries is reached.\
                        If not set, the call will be hanged up after playing the abort sound (if set)'
        ))
    abort_sound = SelectField(
        l_('Abort sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_(
            'The sound played when the caller reach the maximum number of tries.\
                        Not used if an abort destination is set'))
    choices = FieldList(FormField(IvrChoiceForm))
    description = StringField(l_('Description'))
    greeting_sound = SelectField(
        l_('Greeting sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_('The sound played to greet the caller'))
    invalid_destination = DestinationField(
        destination_label=l_('Invalid destination'),
        description=l_(
            'The destination to redirect the caller to when he choose an invalid option.\
                        If not set, the menu will be replayed'))
    invalid_sound = SelectField(
        l_('Invalid Sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_(
            'The sound played when the caller choose an invalid option.\
                        Not used if an invalid destination is set'))
    max_tries = IntegerField(
        l_('Max tries'),
        default=3,
        validators=[NumberRange(min=1)],
        description=l_('The maximum number of tries before aborting the call.\
                        Both a timeout and an invalid choice counts toward the number of tries integer Default:3'
                       ))
    menu_sound = SelectField(
        l_('Menu Sound'),
        choices=[],
        validators=[Length(max=255)],
        description=l_('The sound played to prompt the caller for input'))
    timeout = IntegerField(
        l_('Timeout'),
        default=5,
        validators=[NumberRange(min=0)],
        description=l_(
            'Number of seconds to wait after the menu sound is played before either replaying the menu,\
                        redirecting the call to the timeout destination (if set) or aborting the call\
                        (if the maximum number of tries has been reached) integer Default:5'
        ))
    timeout_destination = DestinationField(
        destination_label=l_('Timeout destination'),
        description=l_(
            'The destination to redirect the caller to on timeout. If not set, the menu will be replayed'
        ))
    submit = SubmitField(l_('Submit'))

    def to_dict(self):
        data = super().to_dict()

        for field in [
                'abort_destination', 'invalid_destination',
                'timeout_destination'
        ]:
            if data.get(field, {}).get('type') == 'none':
                data[field] = None
        return data
コード例 #18
0
class ConfigurationForm(BaseForm):
    general_config = FormField(GeneralConfigurationForm)
    network_config = FormField(NetworkConfigurationForm)
    submit = SubmitField(l_('Submit'))
コード例 #19
0
        class EventForm(ModelForm):
            class Meta:
                model = self.Event

            locations = ModelFieldList(FormField(LocationForm))
コード例 #20
0
 class Outside(Form):
     subforms = FieldList(FormField(Inside, separator="_"), min_entries=1)
コード例 #21
0
ファイル: test_fields.py プロジェクト: yd5011/wtforms
 def setUp(self):
     F = make_form(
         a=StringField(validators=[validators.DataRequired()]), b=StringField()
     )
     self.F1 = make_form("F1", a=FormField(F))
     self.F2 = make_form("F2", a=FormField(F, separator="::"))
コード例 #22
0
 class Outside(Form):
     subforms = FieldList(FormField(Inside), min_entries=1)
コード例 #23
0
ファイル: test_fields.py プロジェクト: yd5011/wtforms
 class A(Form):
     a = FormField(self.F1, validators=[validators.DataRequired()])
コード例 #24
0
class ShippingForm(FlaskForm):
    name = TextField('Name', [InputRequired()])
    email = EmailField('Email', [InputRequired(), Email()])
    address = FormField(AddressForm)
コード例 #25
0
class UserForwardForm(BaseForm):
    busy = FormField(BusyForwardForm)
    noanswer = FormField(NoAnswerForwardForm)
    unconditional = FormField(UnconditionalForwardForm)
コード例 #26
0
ファイル: form.py プロジェクト: ccianos/wazo-ui
class TenantForm(BaseForm):
    name = StringField(l_('Name'), validators=[InputRequired()])
    members = FormField(MembersForm)
    submit = SubmitField()
コード例 #27
0
ファイル: forms.py プロジェクト: mjlavin80/digits_docker_demo
class AddResource(ModelForm):
    class Meta:
        model = Resource
        #recaptcha = RecaptchaField()
    tags = TextField(FormField(AddTag))
コード例 #28
0
 class TemplateForm(form):
     body = FormField(TemplateBodyFieldForm, separator='_')
コード例 #29
0
ファイル: forms.py プロジェクト: pyeu/maps4all
class DetermineRequiredOptionDescriptorForm(Form):
    required_option_descriptor = SelectField('Required Option Descriptor',
                                             validators=[InputRequired()])
    navigation = FormField(NavigationForm)
コード例 #30
0
ファイル: forms.py プロジェクト: akkcheung/flask_hkist
class UploadEntriesForm(FlaskForm):

    upload_entries = FieldList(FormField(UploadForm),
                               min_entries=0,
                               max_entries=3)
コード例 #31
0
class UserServiceForm(BaseForm):
    dnd = FormField(DNDServiceForm)
    incallfilter = FormField(IncallFilterServiceForm)
コード例 #32
0
ファイル: test_fields.py プロジェクト: yd5011/wtforms
 class B(Form):
     a = FormField(self.F1, filters=[lambda x: x])
コード例 #33
0
class EnquiryAddForm(FlaskForm):
    uid = SelectField(_('enquiry user'),
                      validators=[
                          DataRequired(),
                      ],
                      coerce=int,
                      description=_('enquiry user'),
                      render_kw={
                          'rel': 'tooltip',
                          'title': _('enquiry user'),
                      })
    supplier_cid = IntegerField(_('supplier company id'),
                                validators=[
                                    DataRequired(),
                                ],
                                default=0,
                                description=_('supplier company id'),
                                render_kw={
                                    'rel': 'tooltip',
                                    'title': _('supplier company id'),
                                    'placeholder': _('supplier company id'),
                                    'autocomplete': 'off',
                                    'type': 'hidden',
                                })
    supplier_company_name = StringField(_('supplier company name'),
                                        validators=[],
                                        description=_('supplier company name'),
                                        render_kw={
                                            'placeholder':
                                            _('supplier company name'),
                                            'rel':
                                            'tooltip',
                                            'title':
                                            _('supplier company name'),
                                        })
    supplier_contact_id = IntegerField(_('supplier contact id'),
                                       validators=[
                                           DataRequired(),
                                       ],
                                       default=0,
                                       description=_('supplier contact id'),
                                       render_kw={
                                           'rel': 'tooltip',
                                           'title': _('supplier contact id'),
                                           'type': 'hidden',
                                       })
    supplier_contact_name = StringField(_('supplier contact name'),
                                        validators=[],
                                        description=_('supplier contact name'),
                                        render_kw={
                                            'placeholder':
                                            _('supplier contact name'),
                                            'rel':
                                            'tooltip',
                                            'title':
                                            _('supplier contact name'),
                                        })
    delivery_way = StringField(_('delivery way'),
                               validators=[],
                               description=_('delivery way'),
                               render_kw={
                                   'placeholder': _('delivery way'),
                                   'rel': 'tooltip',
                                   'title': _('delivery way'),
                               })
    note = StringField(_('enquiry note'),
                       validators=[],
                       description=_('enquiry note'),
                       render_kw={
                           'placeholder': _('enquiry note'),
                           'rel': 'tooltip',
                           'title': _('enquiry note'),
                       })
    status_order = SelectField(_('order status'),
                               validators=[
                                   InputRequired(),
                               ],
                               coerce=int,
                               description=_('order status'),
                               render_kw={
                                   'rel': 'tooltip',
                                   'title': _('order status'),
                               })
    amount_enquiry = DecimalField(_('amount enquiry'),
                                  validators=[AmountEnquiryValidate()],
                                  description=_('amount enquiry'),
                                  render_kw={
                                      'placeholder': _('amount enquiry'),
                                      'rel': 'tooltip',
                                      'title': _('amount enquiry'),
                                      'type': 'number',
                                      'disabled': 'disabled',
                                  })
    data_line_add = IntegerField(
        '数据行新增',
        validators=[],
    )
    data_line_del = IntegerField(
        '数据行删除',
        validators=[],
    )
    enquiry_items = FieldList(
        FormField(EnquiryItemAddForm),
        label='报价明细',
        min_entries=1,
        max_entries=12,
    )
コード例 #34
0
ファイル: test_fields.py プロジェクト: yd5011/wtforms
        class C(Form):
            a = FormField(self.F1)

            def validate_a(self, field):
                pass
コード例 #35
0
ファイル: forms.py プロジェクト: akkcheung/flask_hkist
class CpdActivityEntriesForm(FlaskForm):

    cpd_activity_entries = FieldList(FormField(CpdActivityEntryForm),
                                     min_entries=0)