summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
authorNatalia <124304+nessita@users.noreply.github.com>2025-03-20 12:21:31 -0300
committernessita <124304+nessita@users.noreply.github.com>2025-03-24 11:53:42 -0300
commitb1c1fd33ed7a1192050b25bd0a256a97326d7692 (patch)
tree568e46bcfe277ef54be6c2f0ba336c982d367949 /django/template
parent639eafbd27926b47f849c0a1f6ff9ebe5380ca57 (diff)
Improved and reorganized querystring template tag docstring and ref docs.
Diffstat (limited to 'django/template')
-rw-r--r--django/template/defaulttags.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 9023bcc87d..a7885e541a 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -1175,24 +1175,25 @@ def now(parser, token):
@register.simple_tag(name="querystring", takes_context=True)
def querystring(context, query_dict=None, **kwargs):
"""
- Add, remove, and change parameters of a ``QueryDict`` and return the result
- as a query string. If the ``query_dict`` argument is not provided, default
- to ``request.GET``.
+ Build a query string using `query_dict` and `kwargs` arguments.
+
+ This tag constructs a new query string by adding, removing, or modifying
+ parameters, starting from the given `query_dict` (defaulting to
+ `request.GET`). Keyword arguments are processed sequentially, with later
+ arguments taking precedence.
For example::
+ {# Set a parameter on top of `request.GET` #}
{% querystring foo=3 %}
- To remove a key::
-
+ {# Remove a key from `request.GET` #}
{% querystring foo=None %}
- To use with pagination::
-
+ {# Use with pagination #}
{% querystring page=page_obj.next_page_number %}
- A custom ``QueryDict`` can also be used::
-
+ {# Use a custom ``QueryDict`` #}
{% querystring my_query_dict foo=3 %}
"""
if query_dict is None: