Reference QuerySet API reference QuerySet APIField lookups
Exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL (see isnull for more details).
251 sections in Django 6.0 Search all versions →
Reference QuerySet API reference QuerySet APIField lookups
Exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL (see isnull for more details).
Reference QuerySet API reference QuerySet APIField lookups
Case-insensitive exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL (see isnull for more details). Example: SQL equivalents: Note the first query will match 'Beatles Blog', 'beatles blog', 'BeAtLes BLoG', etc.
Reference QuerySet API reference QuerySet APIField lookups
For date and datetime fields, an exact year match. Allows chaining additional field lookups. Takes an integer year.
Reference QuerySet API reference QuerySet APIField lookups
For date and datetime fields, an exact month match. Allows chaining additional field lookups. Takes an integer 1 (January) through 12 (December).
Reference QuerySet API reference QuerySet APIField lookups
For date and datetime fields, an exact day match. Allows chaining additional field lookups. Takes an integer day.
Reference QuerySet API reference QuerySet APIField lookups
For datetime and time fields, an exact hour match. Allows chaining additional field lookups. Takes an integer between 0 and 23.
Reference QuerySet API reference QuerySet APIField lookups
For datetime and time fields, an exact minute match. Allows chaining additional field lookups. Takes an integer between 0 and 59.
Reference QuerySet API reference QuerySet APIField lookups
For datetime and time fields, an exact second match. Allows chaining additional field lookups. Takes an integer between 0 and 59.
Reference QuerySet API reference QuerySet APIField lookups
Takes either True or False, which correspond to SQL queries of IS NULL and IS NOT NULL, respectively. Example: SQL equivalent:
Reference QuerySet API reference QuerySet APIField lookups
Case-insensitive regular expression match. Example: SQL equivalents:
Reference The Django template language: for Python programmers
The recommended way to create a Template is by calling the factory methods of the Engine: get_template(), select_template() and from_string(). In a Django project where the TEMPLATES setting defines a DjangoTemplates engine, it’s possible to instantiate a Template directly.
Topic guide Password management in Django How Django stores passwords
Argon2 is the winner of the 2015 Password Hashing Competition, a community organized open competition to select a next generation hashing algorithm.
Topic guide Making queries Retrieving objects
The QuerySet returned by all() describes all objects in the database table. Usually, though, you’ll need to select only a subset of the complete set of objects. To create such a subset, you refine the initial QuerySet, adding filter conditions.
Topic guide Performing raw SQL queries Performing raw queries
raw() automatically maps fields in the query to fields on the model. The order of fields in your query doesn’t matter. In other words, both of the following queries work identically: Matching is done by name.
Topic guide Performing raw SQL queries Performing raw queries
raw() supports indexing, so if you need only the first result you can write: However, the indexing and slicing are not performed at the database level.
Topic guide Performing raw SQL queries Performing raw queries
If you need to perform parameterized queries, you can use the params argument to raw(): params is a list or dictionary of parameters.
Topic guide Working with forms
In HTML, a form is a collection of elements inside <form>...</form> that allow a visitor to do things like enter text, select options, manipulate objects or controls, and so on, and then send that information back to the server.
Topic guide Templates Support for template engines
See also the render() shortcut which calls render_to_string() and feeds the result into an HttpResponse suitable for returning from a view. Finally, you can use configured engines directly: engines : Template engines are available in django.template.engines:
How-to How to write custom lookups
When using the above written abs lookup, the SQL produced will not use indexes efficiently in some cases. In particular, when we use change__abs__lt=27, this is equivalent to change__gt=-27 AND change__lt=27.
Internals Organization of the Django Project Steering council
The steering council selects Mergers as necessary to maintain their number at a minimum of three, in order to spread the workload and avoid over-burdening or burning out any individual Merger.