我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wtforms.fields.IntegerField()。
def convert_int(self, field, field_args): """ ???????????? ????????? ??? ???? Int :param field: ???? Int LightMagic :param field_args: ????????? WTF """ field_min = getattr(field, 'min') field_max = getattr(field, 'max') kwargs = {} if field_min is not None: kwargs['min'] = field_min if field_max is not None: kwargs['max'] = field_max if kwargs: field_args['validators'].append(validators.NumberRange(**kwargs)) return wtforms_fields.IntegerField(**field_args)
def handle_integer_types(self, column, field_args, **extra): unsigned = getattr(column.type, 'unsigned', False) if unsigned: field_args['validators'].append(validators.NumberRange(min=0)) return f.IntegerField(**field_args)
def get_IntegerField(kwargs): """ Returns an ``IntegerField``, applying the ``db.IntegerProperty`` range limits. """ v = validators.NumberRange(min=-0x8000000000000000, max=0x7fffffffffffffff) kwargs['validators'].append(v) return f.IntegerField(**kwargs)
def convert_RatingProperty(model, prop, kwargs): """Returns a form field for a ``db.RatingProperty``.""" kwargs['validators'].append(validators.NumberRange(min=0, max=100)) return f.IntegerField(**kwargs)
def get_IntegerField(kwargs): """ Returns an ``IntegerField``, applying the ``ndb.IntegerProperty`` range limits. """ v = validators.NumberRange(min=-0x8000000000000000, max=0x7fffffffffffffff) kwargs['validators'].append(v) return f.IntegerField(**kwargs)
def handle_integer_types(self, column, field_args, **extra): unsigned = getattr(column.type, 'unsigned', False) if unsigned: field_args['validators'].append(validators.NumberRange(min=0)) return wtforms_fields.IntegerField(**field_args)