djangodocs.org

769 sections in Django dev Search all versions →

Miscellaneous

Release notes Django 5.0 release notes

Filtering querysets against overflowing integer values now always returns an empty queryset. As a consequence, you may need to use ExpressionWrapper() to explicitly wrap arithmetic against integer fields in such cases.

Miscellaneous

Release notes Django 5.0 release notes

The django.db.models.enums.ChoicesMeta metaclass is renamed to ChoicesType. The Prefetch.get_current_queryset() method is deprecated. The get_prefetch_queryset() method of related managers and descriptors is deprecated. Starting with Django 6.0, get_prefetcher() and prefetch_related_objects() will no longer fallback to get_prefetch_queryset(). Subclasses should implement get_prefetch_querysets() instead.

Miscellaneous

Release notes Django 5.1 release notes

To improve performance, the delete_selected admin action now uses QuerySet.bulk_create() when creating multiple LogEntry objects. As a result, pre_save and post_save signals for LogEntry are not sent when multiple objects are deleted via this admin action.

Miscellaneous

Release notes Django 6.2 release notes - UNDER DEVELOPMENT

Omitting the argument is equivalent to the prior safe=False usage. Calling QuerySet.aiterator() after prefetch_related() without providing a chunk_size is deprecated. It currently falls back to a chunk_size of 2000, but a ValueError will be raised in Django 2029.

Other improvements

Release notes Django 1.1 release notes

Other new features and changes introduced since Django 1.0 include: The CSRF protection middleware has been split into two classes – CsrfViewMiddleware checks incoming requests, and CsrfResponseMiddleware processes outgoing responses.

Features removed in 1.9

Release notes Django 1.9 release notes

django.core.cache.get_cache is removed. django.db.models.loading is removed. Passing callable arguments to querysets is no longer possible. BaseCommand.requires_model_validation is removed in favor of requires_system_checks. Admin validators is replaced by admin checks. The ModelAdmin.validator_class and default_validator_class attributes are removed. ModelAdmin.validate() is removed.

Miscellaneous

Release notes Django 2.2 release notes

To improve readability, the UUIDField form field now displays values with dashes, e.g. 550e8400-e29b-41d4-a716-446655440000 instead of 550e8400e29b41d4a716446655440000. On SQLite, PositiveIntegerField and PositiveSmallIntegerField now include a check constraint to prevent negative values in the database.

Models

Release notes Django 3.0 release notes

Added hash database functions MD5, SHA1, SHA224, SHA256, SHA384, and SHA512. Added the Sign database function. The new is_dst parameter of the Trunc database functions determines the treatment of nonexistent and ambiguous datetimes.

Bugfixes

Release notes Django 6.1.2 release notes

Fixed a class of bugs in Django 6.1 that allowed bypassing the depth limiter for deeply nested geometry collections (CVE 2026-15830).

querystring

Reference Built-in template tags and filters

Outputs a URL-encoded formatted query string based on the provided parameters. This tag accepts positional arguments, which must be mappings (such as QueryDict or dict).

Basic usage

Reference Built-in template tags and filters

Outputs the current query string verbatim. So if the query string in the request is ?color=green, the output would be ?color=green. If the current query string is empty, the output will be ?.

Setting items

Reference Built-in template tags and filters

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.

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.

Dynamic usage

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.

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.

Bugfixes

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).