Reference
Built-in template tags and filters
Built-in tag referencequerystring
Adds or modifies parameters in the query string. Each keyword argument will be added to the query string, replacing any existing value for that key. For instance, if the current query string is ?color=green, the output will be ?color=red&size=S.
5.1
5.2
6.0
Reference
Built-in template tags and filters
Built-in tag referencequerystring
Passing None as the value removes the parameter from the query string. For example, if the current query string is ?color=green&size=M, the output will be ?size=M.
5.1
5.2
6.0
Reference
Built-in template tags and filters
Built-in tag referencequerystring
If my_list is ["red", "blue"], the output will be ?color=red&color=blue, preserving the list structure in the query string.
5.1
5.2
6.0
Reference
Built-in template tags and filters
Built-in tag referencequerystring
You can provide a custom QueryDict to be used instead of request.GET. So if my_query_dict is <QueryDict: {'color': ['blue']}>, this outputs ?color=blue.
5.1
5.2
Topic guide
Aggregation
As with the filter() clause, the order in which annotate() and values() clauses are applied to a query is significant. If the values() clause precedes the annotate(), the annotation will be computed using the grouping described by the values() clause.
dev
Reference
Built-in template tags and filters
Built-in tag referencequerystring
You can pass custom QueryDict or dict instances as positional arguments to replace request.GET. When multiple arguments are provided, key-value pairs from later arguments take precedence over earlier ones.
6.0
Reference
Built-in template tags and filters
Built-in tag referencequerystring
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 pages of results.
5.1
5.2
6.0
How-to
How to use Django’s CSRF protection
If you activate CSRF_USE_SESSIONS or CSRF_COOKIE_HTTPONLY, you must include the CSRF token in your HTML and read the token from the DOM with JavaScript:
dev
Reference
Built-in template tags and filters
You can pass custom QueryDict or dict instances as positional arguments to replace request.GET. When multiple arguments are provided, key-value pairs from later arguments take precedence over earlier ones.
dev
Reference
Built-in template tags and filters
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 pages of results.
dev
How-to
How to use Django’s CSRF protection
Using CSRF protection with AJAX
If you activate CSRF_USE_SESSIONS or CSRF_COOKIE_HTTPONLY, you must include the CSRF token in your HTML and read the token from the DOM with JavaScript:
4.2
5.0
5.1
5.2
6.0
Release notes
Django 5.1 release notes
Django 5.1 introduces the {% 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.
dev
Release notes
Django 5.1 release notes
What’s new in Django 5.1
Django 5.1 introduces the {% 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.
5.1
5.2
6.0
Release notes
Django 5.1.7 release notes
Fixed a bug in Django 5.1 where the {% querystring %} template tag returned an empty string rather than "?" when all parameters had been removed from the query string (#36182).
dev
Release notes
Django 5.1.7 release notes
Fixed a bug in Django 5.1 where the {% querystring %} template tag returned an empty string rather than "?" when all parameters had been removed from the query string (#36182).
5.1
5.2
6.0
Release notes
Django 6.0 release notes
The new variable forloop.length is now available within a for loop. The querystring template tag now consistently prefixes the returned query string with a ?, ensuring reliable link generation behavior.
dev
Release notes
Django 6.0 release notes
What’s new in Django 6.0Minor features
The new variable forloop.length is now available within a for loop. The querystring template tag now consistently prefixes the returned query string with a ?, ensuring reliable link generation behavior.
6.0
Release notes
Archive of security issues
Data leakage via querystring manipulation in admin. Full description
dev
Release notes
Archive of security issues
Issues under Django’s security process
Data leakage via querystring manipulation in admin. Full description
4.2
5.0
5.1
5.2
6.0
Release notes
Django 1.1.3 release notes
The Django administrative interface, django.contrib.admin, supports filtering of displayed lists of objects by fields on the corresponding models, including across database-level relationships.
dev