djangodocs.org

246 sections in Django 5.1 Search all versions →

Bugfixes

Release notes Django 3.1.1 release notes

Fixed wrapping of translated action labels in the admin’s navigation sidebar for East Asian languages (#31853). Fixed wrapping of long model names in the admin’s navigation sidebar (#31854).

Features removed in 1.10

Release notes Django 1.10 release notes

These features have reached the end of their deprecation cycle and are removed in Django 1.10. See Features deprecated in 1.8 for details, including how to remove usage of these features.

Bugfixes

Release notes Django 1.11.1 release notes

Made migrations respect Index’s name argument. If you created a named index with Django 1.11, makemigrations will create a migration to recreate the index with the correct name (#28051).

Templates

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

The Context.push() method now returns a context manager which automatically calls pop() upon exiting the with statement. Additionally, push() now accepts parameters that are passed to the dict constructor used to build the new context level.

Bugfixes

Release notes Django 1.8.1 release notes

Added support for serializing timedelta objects in migrations (#24566). Restored proper parsing of the testserver command’s positional arguments (fixture names) (#24571). Prevented TypeError in translation functions check_for_language() and get_language_bidi() when translations are deactivated (#24569).

Reference GIS QuerySet API Reference Spatial Lookupsrelate

On these spatial backends the intersection pattern is a string comprising nine characters, which define intersections between the interior, boundary, and exterior of the geometry field and the lookup geometry.

Oracle

Reference GIS QuerySet API Reference Spatial Lookupsrelate

Here the relation pattern is comprised of at least one of the nine relation strings: TOUCH, OVERLAPBDYDISJOINT, OVERLAPBDYINTERSECT, EQUAL, INSIDE, COVEREDBY, CONTAINS, COVERS, ON, and ANYINTERACT. Multiple strings may be combined with the logical Boolean operator OR, for example, 'inside+touch'.

Models

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

Django now logs at most 9000 queries in connections.queries, in order to prevent excessive memory usage in long-running processes in debug mode.

Select

Reference Widgets Built-in widgetsSelector and checkbox widgets

classSelect[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html' - Renders as: <select><option ...>...</select>

select_on_save

Reference Model Meta options Available Meta options

Options.select_on_save : Determines if Django will use the pre-1.6 django.db.models.Model.save() algorithm. The old algorithm uses SELECT to determine if there is an existing row to be updated. The new algorithm tries an UPDATE directly.

select_for_update()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

Evaluating a queryset with select_for_update() in autocommit mode on backends which support SELECT ... FOR UPDATE is a TransactionManagementError error because the rows are not locked in that case.

Reference Databases MySQL notes

MySQL and MariaDB do not support some options to the SELECT ... FOR UPDATE statement. If select_for_update() is used with an unsupported option, then a NotSupportedError is raised.

extra()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

extra(select=None,where=None,params=None,tables=None,order_by=None,select_params=None) Sometimes, the Django query syntax by itself can’t easily express a complex WHERE clause. For these edge cases, Django provides the extra() QuerySet modifier — a hook for injecting specific clauses into the SQL generated by a QuerySet.

extra()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

The resulting SQL of the above example would be: Note that the parentheses required by most database engines around subqueries are not required in Django’s select clauses.

Topic guide Translation Internationalization: in template code

If you want to select a language within a template, you can use the language template tag: While the first occurrence of “Welcome to our page” uses the current language, the second will always be in English.

ChoiceField

Reference Form fields Built-in Field classes

classChoiceField(**kwargs)[source] : - Default widget: Select - Empty value: '' (an empty string) - Normalizes to: A string. - Validates that the given value exists in the list of choices. - Error message keys: required, invalid_choice