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:
Claude Paroz 2015-01-12 12:00:27 +01:00
parent 5f7230e12f
commit f48e2258a9
6 changed files with 94 additions and 13 deletions

View file

@ -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