Loading django/contrib/flatpages/forms.py +5 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,11 @@ class FlatpageForm(forms.ModelForm): url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$', help_text=_("Example: '/about/contact/'. Make sure to have leading" " and trailing slashes."), error_message=_("This value must contain only letters, numbers," " dots, underscores, dashes, slashes or tildes.")) error_messages={ "invalid": _("This value must contain only letters, numbers," " dots, underscores, dashes, slashes or tildes."), }, ) class Meta: model = FlatPage Loading django/forms/fields.py +6 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ from django.forms.widgets import ( from django.utils import formats from django.utils.encoding import smart_text, force_str, force_text from django.utils.ipv6 import clean_ipv6_address from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning from django.utils import six from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit from django.utils.translation import ugettext_lazy as _, ungettext_lazy Loading Loading @@ -531,6 +531,11 @@ class RegexField(CharField): """ # error_message is just kept for backwards compatibility: if error_message is not None: warnings.warn( "The 'error_message' argument is deprecated. Use " "Field.error_messages['invalid'] instead.", RemovedInDjango20Warning, stacklevel=2 ) error_messages = kwargs.get('error_messages') or {} error_messages['invalid'] = error_message kwargs['error_messages'] = error_messages Loading docs/internals/deprecation.txt +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ about each item can often be found in the release notes of two versions prior. * ``django.template.resolve_variable`` will be removed. * The ``error_message`` argument of ``django.forms.RegexField`` will be removed. .. _deprecation-removed-in-1.9: 1.9 Loading docs/ref/forms/fields.txt +7 −4 Original line number Diff line number Diff line Loading @@ -805,10 +805,13 @@ For each field, we describe the default widget used if you don't specify Also takes ``max_length`` and ``min_length``, which work just as they do for ``CharField``. .. deprecated:: 1.8 The optional argument ``error_message`` is also accepted for backwards compatibility. The preferred way to provide an error message is to use the ``error_messages`` argument, passing a dictionary with ``'invalid'`` as a key and the error message as the value. compatibility but will be removed in Django 2.0. The preferred way to provide an error message is to use the :attr:`~Field.error_messages` argument, passing a dictionary with ``'invalid'`` as a key and the error message as the value. ``SlugField`` ~~~~~~~~~~~~~ Loading docs/releases/1.8.txt +6 −0 Original line number Diff line number Diff line Loading @@ -625,3 +625,9 @@ The function has been informally marked as "Deprecated" for some time. Replace It provided the :ttag:`lorem` template tag which is now included in the built-in tags. Simply remove ``'django.contrib.webdesign'`` from :setting:`INSTALLED_APPS` and ``{% load webdesign %}`` from your templates. ``error_message`` argument to ``django.forms.RegexField`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It provided backwards compatibility for pre-1.0 code, but its functionality is redundant. Use ``Field.error_messages['invalid']`` instead. Loading
django/contrib/flatpages/forms.py +5 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,11 @@ class FlatpageForm(forms.ModelForm): url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$', help_text=_("Example: '/about/contact/'. Make sure to have leading" " and trailing slashes."), error_message=_("This value must contain only letters, numbers," " dots, underscores, dashes, slashes or tildes.")) error_messages={ "invalid": _("This value must contain only letters, numbers," " dots, underscores, dashes, slashes or tildes."), }, ) class Meta: model = FlatPage Loading
django/forms/fields.py +6 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ from django.forms.widgets import ( from django.utils import formats from django.utils.encoding import smart_text, force_str, force_text from django.utils.ipv6 import clean_ipv6_address from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning from django.utils import six from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit from django.utils.translation import ugettext_lazy as _, ungettext_lazy Loading Loading @@ -531,6 +531,11 @@ class RegexField(CharField): """ # error_message is just kept for backwards compatibility: if error_message is not None: warnings.warn( "The 'error_message' argument is deprecated. Use " "Field.error_messages['invalid'] instead.", RemovedInDjango20Warning, stacklevel=2 ) error_messages = kwargs.get('error_messages') or {} error_messages['invalid'] = error_message kwargs['error_messages'] = error_messages Loading
docs/internals/deprecation.txt +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ about each item can often be found in the release notes of two versions prior. * ``django.template.resolve_variable`` will be removed. * The ``error_message`` argument of ``django.forms.RegexField`` will be removed. .. _deprecation-removed-in-1.9: 1.9 Loading
docs/ref/forms/fields.txt +7 −4 Original line number Diff line number Diff line Loading @@ -805,10 +805,13 @@ For each field, we describe the default widget used if you don't specify Also takes ``max_length`` and ``min_length``, which work just as they do for ``CharField``. .. deprecated:: 1.8 The optional argument ``error_message`` is also accepted for backwards compatibility. The preferred way to provide an error message is to use the ``error_messages`` argument, passing a dictionary with ``'invalid'`` as a key and the error message as the value. compatibility but will be removed in Django 2.0. The preferred way to provide an error message is to use the :attr:`~Field.error_messages` argument, passing a dictionary with ``'invalid'`` as a key and the error message as the value. ``SlugField`` ~~~~~~~~~~~~~ Loading
docs/releases/1.8.txt +6 −0 Original line number Diff line number Diff line Loading @@ -625,3 +625,9 @@ The function has been informally marked as "Deprecated" for some time. Replace It provided the :ttag:`lorem` template tag which is now included in the built-in tags. Simply remove ``'django.contrib.webdesign'`` from :setting:`INSTALLED_APPS` and ``{% load webdesign %}`` from your templates. ``error_message`` argument to ``django.forms.RegexField`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It provided backwards compatibility for pre-1.0 code, but its functionality is redundant. Use ``Field.error_messages['invalid']`` instead.