diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-07-15 18:28:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-15 13:28:55 -0300 |
| commit | 27043bde5b795eb4a605aeca1d3bc4345d2ca478 (patch) | |
| tree | b00dd8c3e01ae68ad5293738c709b1a34b33eaf8 /docs | |
| parent | 65344f0e1ecfff3e9623c18c51eff8fe72f9a9df (diff) | |
Refs #10941 -- Renamed query_string template tag to querystring.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 18 | ||||
| -rw-r--r-- | docs/releases/5.1.txt | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 4cfd1d8f71..b920478700 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -952,9 +952,9 @@ output (as a string) inside a variable. This is useful if you want to use {% now "Y" as current_year %} {% blocktranslate %}Copyright {{ current_year }}{% endblocktranslate %} -.. templatetag:: query_string +.. templatetag:: querystring -``query_string`` +``querystring`` ---------------- .. versionadded:: 5.1 @@ -975,14 +975,14 @@ query string is ``?color=green&size=M``, the output would be .. code-block:: html+django - {% query_string %} + {% querystring %} You can also pass in a custom ``QueryDict`` that will be used instead of ``request.GET``: .. code-block:: html+django - {% query_string my_query_dict %} + {% querystring my_query_dict %} Each keyword argument will be added to the query string, replacing any existing value for that key. With the query string ``?color=blue``, the following would @@ -990,14 +990,14 @@ result in ``?color=red&size=S``: .. code-block:: html+django - {% query_string color="red" size="S" %} + {% querystring color="red" size="S" %} It is possible to remove parameters by passing ``None`` as a value. With the query string ``?color=blue&size=M``, the following would result in ``?size=M``: .. code-block:: html+django - {% query_string color=None %} + {% querystring color=None %} If the given parameter is a list, the value will remain as a list. For example, if ``my_list`` is set to ``["red", "blue"]``, the following would result in @@ -1005,7 +1005,7 @@ if ``my_list`` is set to ``["red", "blue"]``, the following would result in .. code-block:: html+django - {% query_string color=my_list %} + {% querystring color=my_list %} A common example of using this tag is to preserve the current query string when displaying a page of results, while adding a link to the next and previous @@ -1015,14 +1015,14 @@ would output ``?color=blue&size=M&page=4``: .. code-block:: html+django - {% query_string page=page.next_page_number %} + {% querystring page=page.next_page_number %} You can also store the value in a variable, for example, if you need multiple links to the same page with syntax such as: .. code-block:: html+django - {% query_string page=page.next_page_number as next_page %} + {% querystring page=page.next_page_number as next_page %} .. templatetag:: regroup diff --git a/docs/releases/5.1.txt b/docs/releases/5.1.txt index 49741ca81c..db7ea41e52 100644 --- a/docs/releases/5.1.txt +++ b/docs/releases/5.1.txt @@ -26,10 +26,10 @@ only officially support the latest release of each series. What's new in Django 5.1 ======================== -``{% query_string %}`` template tag +``{% querystring %}`` template tag ----------------------------------- -Django 5.1 introduces the :ttag:`{% query_string %} <query_string>` template +Django 5.1 introduces the :ttag:`{% querystring %} <querystring>` template tag, simplifying the modification of query parameters in URLs, making it easier to generate links that maintain existing query parameters while adding or changing specific ones. @@ -53,7 +53,7 @@ When switching to using this new template tag, the above magically becomes: .. code-block:: html+django - <a href="{% query_string page=page.next_page_number %}">Next page</a> + <a href="{% querystring page=page.next_page_number %}">Next page</a> PostgreSQL Connection Pools --------------------------- |
