From 7d84e5473a42ddc8222491748114570b69831885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigurd=20Lj=C3=B8dal?= <544451+ljodal@users.noreply.github.com> Date: Tue, 10 May 2022 19:43:49 +0200 Subject: [PATCH] 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 --- django-stubs/forms/fields.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/forms/fields.pyi b/django-stubs/forms/fields.pyi index b425633..8849928 100644 --- a/django-stubs/forms/fields.pyi +++ b/django-stubs/forms/fields.pyi @@ -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 = ...,