djangodocs.org

251 sections in Django 5.2 Search all versions →

Topic guide Making queries

Keyword argument queries – in filter(), etc. – are “AND”ed together. If you need to execute more complex queries (for example, queries with OR statements), you can use Q objects.

Topic guide Translation Internationalization: in template code

Contrarily to the translate tag, the blocktranslate tag allows you to mark complex sentences consisting of literals and variable content for translation by making use of placeholders: To translate a template expression – say, accessing object attributes or using template …

Topic guide How to install Django

If you plan to use Django’s database API functionality, you’ll need to make sure a database server is running. Django supports many different database servers and is officially supported with PostgreSQL, MariaDB, MySQL, Oracle and SQLite.

Tagging tests

Topic guide Testing tools Test cases features

You can tag your tests so you can easily run a particular subset.

Release notes Django 1.4 release notes What’s new in Django 1.4

Django 1.4 includes a QuerySet.select_for_update() method, which generates a SELECT ... FOR UPDATE SQL query. This will lock rows until the end of the transaction, meaning other transactions cannot modify or delete rows matched by a FOR UPDATE query.

Release notes Django 1.6.3 release notes

Historically, queries that use select_for_update() could be executed in autocommit mode, outside of a transaction. Before Django 1.6, Django’s automatic transactions mode allowed this to be used to lock records until the next write operation.

Release notes Django 1.7 release notes Backwards incompatible changes in 1.7

Historically, queries that use select_for_update() could be executed in autocommit mode, outside of a transaction. Before Django 1.6, Django’s automatic transactions mode allowed this to be used to lock records until the next write operation.

Models

Release notes Django 5.2 release notes What’s new in Django 5.2Minor features

The SELECT clause generated when using QuerySet.values() and QuerySet.values_list() now matches the specified order of the referenced expressions. Previously, the order was based on a set of counterintuitive rules which made query combination through methods such as QuerySet.union() unpredictable.

Bugfixes

Release notes Django 1.10.1 release notes

Fixed a crash in MySQL connections where SELECT @@SQL_AUTO_IS_NULL doesn’t return a result (#26991). Allowed User.is_authenticated and User.is_anonymous properties to be compared using ==, !=, and | (#26988, #27154). Removed the broken BaseCommand.usage() method which was for optparse support (#27000).

Bugfixes

Release notes Django 1.10.2 release notes

Fixed a crash in MySQL database validation where SELECT @@sql_mode doesn’t return a result (#27180). Allowed combining contrib.postgres.search.SearchQuery with more than one & or | operators (#27143). Disabled system check for URL patterns beginning with a ‘/’ when APPEND_SLASH=False (#27238).

Database backends

Release notes Django 1.11 release notes What’s new in Django 1.11Minor features

Added the skip_locked argument to QuerySet.select_for_update() on PostgreSQL 9.5+ and Oracle to execute queries with FOR UPDATE SKIP LOCKED. Added the TEST['TEMPLATE'] setting to let PostgreSQL users specify a template for creating the test database.

Bugfixes

Release notes Django 2.1.15 release notes

Fixed a data loss possibility in the select_for_update(). When using 'self' in the of argument with multi-table inheritance, a parent model was locked instead of the queryset’s model (#30953).

Models

Release notes Django 3.2 release notes What’s new in Django 3.2Minor features

The new no_key parameter for QuerySet.select_for_update(), supported on PostgreSQL, allows acquiring weaker locks that don’t block the creation of rows that reference locked rows through a foreign key. When() expression now allows using the condition argument with lookups.

Admin “actions”

Release notes Django 1.1 release notes What’s new in Django 1.1New admin features

You can now define admin actions that can perform some action to a group of models in bulk. Users will be able to select objects on the change list page and then apply these bulk actions to all selected objects.

Release notes Django 1.11 release notes Backwards incompatible changes in 1.11

Some undocumented classes in django.forms.widgets are removed: SubWidget RendererMixin, ChoiceFieldRenderer, RadioFieldRenderer, CheckboxFieldRenderer ChoiceInput, RadioChoiceInput, CheckboxChoiceInput The undocumented Select.render_option() method is removed. The Widget.format_output() method is removed. Use a custom widget template instead.

Bugfixes

Release notes Django 1.11.5 release notes

Fixed GEOS version parsing if the version has a commit hash at the end (new in GEOS 3.6.2) (#28441). Added compatibility for cx_Oracle 6 (#28498). Fixed select widget rendering when option values are tuples (#28502).

Release notes Django 1.5 release notes What’s new in Django 1.5

The method Model.save() has a new keyword argument update_fields. By using this argument it is possible to save only a select list of model’s fields. This can be useful for performance reasons or when trying to avoid overwriting concurrent changes.

Release notes Django 1.6 release notes What’s new in Django 1.6

The Model.save() method now tries to directly UPDATE the database if the instance has a primary key value. Previously SELECT was performed to determine if UPDATE or INSERT were needed.

Release notes Django 1.8 release notes Features deprecated in 1.8

The following functions will no longer accept a dirs parameter to override TEMPLATE_DIRS in Django 1.10: django.template.loader.get_template() django.template.loader.select_template() django.shortcuts.render() django.shortcuts.render_to_response() The parameter didn’t work consistently across different template loaders and didn’t work for included templates.