我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用wtforms.fields.DecimalField()。
def handle_decimal_types(self, column, field_args, **extra): places = getattr(column.type, 'scale', 2) if places is not None: field_args['places'] = places return f.DecimalField(**field_args)
def handle_decimal_types(self, column, field_args, **extra): # override default decimal places limit, use database defaults instead field_args.setdefault('places', None) return wtforms_fields.DecimalField(**field_args)
def conv_Decimal(self, model, field, kwargs): self._number_common(model, field, kwargs) return f.DecimalField(**kwargs)
def coerce(self, field_type): coercions = { "IntField": int, "BooleanField": bool, "FloatField": float, "DecimalField": decimal.Decimal, "ObjectIdField": ObjectId } if sys.version_info >= (3, 0): return coercions.get(field_type, str) else: return coercions.get(field_type, unicode)