Opened 6 years ago

Closed 6 years ago

#29285 closed Uncategorized (invalid)

forms.DecimalField doesn't recognise max_decimal_places kwarg

Reported by: Paul Korir Owned by: nobody
Component: Documentation Version: 2.0
Severity: Normal Keywords: fields, max_decimal_places
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Claude Paroz)

Documentation ( states that max_decimal_places is a kwarg

File "/Users/paulkorir/Documents/Code/Python/Django/project-classified/project_classified/listings/", line 48, in AdvancedSearch
    price_minimum = forms.DecimalField(required=False, min_value=0, max_value=2, max_decimal_places=2)
  File "/Users/paulkorir/miniconda3/envs/project_classified/lib/python3.6/site-packages/django/forms/", line 330, in __init__
    super().__init__(max_value=max_value, min_value=min_value, **kwargs)
  File "/Users/paulkorir/miniconda3/envs/project_classified/lib/python3.6/site-packages/django/forms/", line 254, in __init__
TypeError: __init__() got an unexpected keyword argument 'max_decimal_places'

However, works with decimal_places instead of max_decimal_places

Change History (2)

comment:1 by Claude Paroz, 6 years ago

Description: modified (diff)

comment:2 by Claude Paroz, 6 years ago

Resolution: invalid
Status: newclosed

Please read the documentation once more, max_decimal_places is a key of the error messages dict, the kwarg is documented as being decimal_places.

Note: See TracTickets for help on using tickets.
Back to Top