diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-06-03 16:49:01 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-06-03 10:49:01 -0400 |
| commit | 43b574007ef5edfe11f3b899fbe0a6fc05c43774 (patch) | |
| tree | 18b9944c32bf98c70ed6d3d02853195e9f1b4055 /docs | |
| parent | ecae9c7aec3012788e08dea60bede63405c860fa (diff) | |
Fixed #28192 -- Required passing optional form field args as keyword args.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/forms/fields.txt | 4 | ||||
| -rw-r--r-- | docs/releases/2.0.txt | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 442ec58da9..473ce3d4e0 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -1006,7 +1006,7 @@ Slightly complex built-in ``Field`` classes from django.core.validators import RegexValidator class PhoneField(MultiValueField): - def __init__(self, *args, **kwargs): + def __init__(self, **kwargs): # Define one message for all fields. error_messages = { 'incomplete': 'Enter a country calling code and a phone number.', @@ -1030,7 +1030,7 @@ Slightly complex built-in ``Field`` classes ) super().__init__( error_messages=error_messages, fields=fields, - require_all_fields=False, *args, **kwargs + require_all_fields=False, **kwargs ) .. attribute:: MultiValueField.widget diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index d1ea0cef48..9c0f960d35 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -351,6 +351,19 @@ now prohibited, e.g.:: ... TypeError: Cannot reverse a query once a slice has been taken. +Form fields no longer accept optional arguments as positional arguments +----------------------------------------------------------------------- + +To help prevent runtime errors due to incorrect ordering of form field +arguments, optional arguments of built-in form fields are no longer accepted +as positional arguments. For example:: + + forms.IntegerField(25, 10) + +raises an exception and should be replaced with:: + + forms.IntegerField(max_value=25, min_value=10) + Miscellaneous ------------- |
