本文整理匯總了Python中django.core.validators.DecimalValidator方法的典型用法代碼示例。如果您正苦於以下問題:Python validators.DecimalValidator方法的具體用法?Python validators.DecimalValidator怎麽用?Python validators.DecimalValidator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.core.validators
的用法示例。
在下文中一共展示了validators.DecimalValidator方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from django.core import validators [as 別名]
# 或者: from django.core.validators import DecimalValidator [as 別名]
def __init__(self, *, max_value=None, min_value=None, max_digits=None, decimal_places=None, **kwargs):
self.max_digits, self.decimal_places = max_digits, decimal_places
super().__init__(max_value=max_value, min_value=min_value, **kwargs)
self.validators.append(validators.DecimalValidator(max_digits, decimal_places))
示例2: validators
# 需要導入模塊: from django.core import validators [as 別名]
# 或者: from django.core.validators import DecimalValidator [as 別名]
def validators(self):
return super().validators + [
validators.DecimalValidator(self.max_digits, self.decimal_places)
]
示例3: __init__
# 需要導入模塊: from django.core import validators [as 別名]
# 或者: from django.core.validators import DecimalValidator [as 別名]
def __init__(self, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs):
self.max_digits, self.decimal_places = max_digits, decimal_places
super(DecimalField, self).__init__(max_value, min_value, *args, **kwargs)
self.validators.append(validators.DecimalValidator(max_digits, decimal_places))
示例4: validators
# 需要導入模塊: from django.core import validators [as 別名]
# 或者: from django.core.validators import DecimalValidator [as 別名]
def validators(self):
return super(DecimalField, self).validators + [
validators.DecimalValidator(self.max_digits, self.decimal_places)
]