diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-01-12 12:00:27 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-01-12 22:51:22 +0100 |
| commit | f48e2258a96a08dcec843921206bcf7656e3ae45 (patch) | |
| tree | ee6c9a0afae7ceeb053d7cf2d76a4b50c9f3545b /docs | |
| parent | 5f7230e12f0d237cdc19d8930006b0fc7d9dbaa6 (diff) | |
Fixed #24133 -- Replaced formatting syntax in success_url placeholders
Thanks Laurent Payot for the report, and Markus Holtermann, Tim Graham
for the reviews.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/internals/deprecation.txt | 3 | ||||
| -rw-r--r-- | docs/ref/class-based-views/mixins-editing.txt | 16 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 12 |
3 files changed, 29 insertions, 2 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 4e03378f06..0a460b7739 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -158,6 +158,9 @@ details on these changes. and ``Storage.save()`` to be defined without a ``max_length`` argument will be removed. +* Support for the legacy ``%(<foo>)s`` syntax in ``ModelFormMixin.success_url`` + will be removed. + .. _deprecation-removed-in-1.9: 1.9 diff --git a/docs/ref/class-based-views/mixins-editing.txt b/docs/ref/class-based-views/mixins-editing.txt index 3dcf28dae3..0bfbcbd3f7 100644 --- a/docs/ref/class-based-views/mixins-editing.txt +++ b/docs/ref/class-based-views/mixins-editing.txt @@ -160,9 +160,15 @@ ModelFormMixin ``success_url`` may contain dictionary string formatting, which will be interpolated against the object's field attributes. For - example, you could use ``success_url="/polls/%(slug)s/"`` to + example, you could use ``success_url="/polls/{slug}/"`` to redirect to a URL composed out of the ``slug`` field on a model. + .. versionchanged:: 1.8 + + Support for the new brace-based Python formatting syntax has been + added. The old ``%(slug)s`` placeholder syntax support has been + deprecated and will be removed in Django 2.0. + .. method:: get_form_class() Retrieve the form class to instantiate. If @@ -248,9 +254,15 @@ DeletionMixin ``success_url`` may contain dictionary string formatting, which will be interpolated against the object's field attributes. For example, you - could use ``success_url="/parent/%(parent_id)s/"`` to redirect to a URL + could use ``success_url="/parent/{parent_id}/"`` to redirect to a URL composed out of the ``parent_id`` field on a model. + .. versionchanged:: 1.8 + + Support for the new brace-based Python formatting syntax has been + added. The old ``%(slug)s`` placeholder syntax support has been + deprecated and will be removed in Django 2.0. + .. method:: get_success_url() Returns the url to redirect to when the nominated object has been diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index a07a209347..cd9a5de682 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -388,6 +388,11 @@ Generic Views require a ``form_class`` to be provided anymore. If not provided ``form_class`` defaults to :meth:`~django.views.generic.edit.FormMixin.get_form_class()`. +* Placeholders in :attr:`ModelFormMixin.success_url + <django.views.generic.edit.ModelFormMixin.success_url>` now support the Python + :py:meth:`str.format()` syntax. The legacy ``%(<foo>)s`` syntax is still + supported but will be removed in Django 2.0. + Internationalization ^^^^^^^^^^^^^^^^^^^^ @@ -1550,6 +1555,13 @@ will be removed in Django 2.0. Using a single equals sign with the ``{% if %}`` template tag for equality testing was undocumented and untested. It's now deprecated in favor of ``==``. +``%(<foo>)s`` syntax in ``ModelFormMixin.success_url`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The legacy ``%(<foo>)s`` syntax in :attr:`ModelFormMixin.success_url + <django.views.generic.edit.ModelFormMixin.success_url>` is deprecated and +will be removed in Django 2.0. + .. removed-features-1.8: Features removed in 1.8 |
