Topic guide Aggregation Aggregations and other QuerySet clausesvalues()
Fields that are mentioned in the order_by() part of a queryset are used when selecting the output data, even if they are not otherwise specified in the values() call.
256 sections in Django dev Search all versions →
Topic guide Aggregation Aggregations and other QuerySet clausesvalues()
Fields that are mentioned in the order_by() part of a queryset are used when selecting the output data, even if they are not otherwise specified in the values() call.
Topic guide Aggregation Aggregations and other QuerySet clauses
When using the values() clause to group query results for annotations in MySQL with the ONLY_FULL_GROUP_BY SQL mode enabled, you may need to apply AnyValue if the annotation includes a mix of aggregate and non-aggregate expressions.
Topic guide Models Fields
Django places some restrictions on model field names: A field name cannot be a Python reserved word, because that would result in a Python syntax error.
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.
Topic guide Templates Support for template engines
The django.template.loader module defines two functions to load templates. get_template(template_name,using=None)[source] : This function loads the template with the given name and returns a Template object. select_template(template_name_list,using=None)[source] : select_template() is just like get_template(), except it takes a list of template names.
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.
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.
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).
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).
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.
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).
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.
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.
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).