Skip to content

Commit d1beb9f

Browse files
authored
[3.15] Add DecimalField normalize_output argument (#576) (#584)
1 parent e12e8ef commit d1beb9f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

rest_framework-stubs/fields.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ class DecimalField(Field[Decimal, int | float | str | Decimal, str, Any]):
332332
min_value: Decimal | int | float | None
333333
localize: bool
334334
rounding: str | None
335+
normalize_output: bool
335336
max_whole_digits: int | None
336337
def __init__(
337338
self,
@@ -342,6 +343,7 @@ class DecimalField(Field[Decimal, int | float | str | Decimal, str, Any]):
342343
min_value: Decimal | int | float | None = None,
343344
localize: bool = ...,
344345
rounding: str | None = None,
346+
normalize_output: bool = ...,
345347
*,
346348
read_only: bool = ...,
347349
write_only: bool = ...,

scripts/stubtest/allowlist_todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,12 @@ rest_framework.views.GenericView
138138

139139
# Added in 3.15:
140140
rest_framework.authtoken.migrations.0004_alter_tokenproxy_options
141-
rest_framework.fields.DecimalField.__init__
142141
rest_framework.fields.Field.__class_getitem__
143142
rest_framework.filters.search_smart_split
144143
rest_framework.generics.GenericAPIView.__class_getitem__
145144
rest_framework.request.Request.__class_getitem__
146145
rest_framework.response.Response.__class_getitem__
147146
rest_framework.routers.BaseRouter.is_already_registered
148-
rest_framework.serializers.DecimalField.__init__
149147
rest_framework.serializers.Field.__class_getitem__
150148
rest_framework.serializers.LIST_SERIALIZER_KWARGS_REMOVE
151149
rest_framework.serializers.ListSerializer.run_child_validation

tests/typecheck/test_fields.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from django.db import models
1414
from rest_framework.fields import DecimalField, IPAddressField, SlugField, RegexField, ModelField, SerializerMethodField, ChoiceField, DateTimeField, DateField, TimeField
1515
16-
DecimalField(1, 1, False, 1, 1, False, None)
17-
DecimalField(1, 1, False, 1, 1, False, None, True) # E: Too many positional arguments for "DecimalField"
16+
DecimalField(1, 1, False, 1, 1, False, None, False)
17+
DecimalField(1, 1, False, 1, 1, False, None, False, True) # E: Too many positional arguments for "DecimalField"
1818
1919
IPAddressField('both')
2020
IPAddressField('both', True) # E: Too many positional arguments for "IPAddressField"

0 commit comments

Comments
 (0)