Fix type of min_value and max_value on DecimalField (#951)

* Fix type of min_value and max_value on DecimalField

These should at the very least allow Decimals. Technically you can send
in anything that's comparable to a Decimal, but I'm not sure if it makes
sense to allow floats. Could allow both ints and Decimals I guess?

* Allow ints and floats as well

* Update django-stubs/forms/fields.pyi

* Update django-stubs/forms/fields.pyi

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Sigurd Ljødal
2022-05-10 19:43:49 +02:00
committed by GitHub
parent 1a36c6c379
commit 7d84e5473a

View File

@@ -125,8 +125,8 @@ class DecimalField(IntegerField):
def __init__(
self,
*,
max_value: Optional[int] = ...,
min_value: Optional[int] = ...,
max_value: Union[Decimal, int, float, None] = ...,
min_value: Union[Decimal, int, float, None] = ...,
max_digits: Optional[int] = ...,
decimal_places: Optional[int] = ...,
required: bool = ...,