mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #24133 -- Replaced formatting syntax in success_url placeholders
Thanks Laurent Payot for the report, and Markus Holtermann, Tim Graham for the reviews.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user