djangodocs.org

477 sections across all versions Narrow to Django 6.0 (current) →

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.

dev

Write a minimal form

Tutorial Writing your first Django app, part 4

Let’s update our poll detail template (“polls/detail.html”) from the last tutorial, so that the template contains an HTML <form> element: polls/templates/polls/detail.html A quick rundown: The above template displays a radio button for each question choice.

4.2 5.0 5.1 5.2 6.0

Configurable attributes

Reference Applications Application configuration

AppConfig.name : Full Python path to the application, e.g. 'django.contrib.admin'. AppConfig.label : Short name for the application, e.g. 'admin' AppConfig.verbose_name : Human-readable name for the application, e.g. “Administration”. AppConfig.path : Filesystem path to the application directory, e.g. '/usr/lib/pythonX.Y/dist-packages/django/contrib/admin'.

4.2 5.0 5.1 5.2 6.0

Reference QuerySet API reference

Internally, a QuerySet can be constructed, filtered, sliced, and generally passed around without actually hitting the database. No database activity actually occurs until you do something to evaluate the queryset. You can evaluate a QuerySet in the following ways: Iteration.

4.2 5.0 5.1 5.2 6.0

values_list()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

values_list(*fields,flat=False,named=False) This is similar to values() except that instead of returning dictionaries, it returns tuples when iterated over.

5.2 6.0

explain()

Reference QuerySet API reference QuerySet APIMethods that do not return QuerySets

explain(format=None,**options) aexplain(format=None,**options) Asynchronous version: aexplain() Returns a string of the QuerySet’s execution plan, which details how the database would execute the query, including any indexes or joins that would be used.

4.2 5.0 5.1 5.2 6.0

AnyValue

Reference QuerySet API reference QuerySet APIAggregation functions

New in Django 6.0. classAnyValue(expression,output_field=None,filter=None,default=None,**extra)[source] : Returns an arbitrary value from the non-null input values.

6.0

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.

4.2 5.0 5.1 5.2 6.0

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.

6.0

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 …

4.2 5.0 5.1 5.2 6.0

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.

4.2 5.0 5.1 5.2 6.0