djangodocs.org

238 sections in Django 4.2 Search all versions →

hour

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.

minute

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.

second

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.

isnull

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:

iregex

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive regular expression match. Example: SQL equivalents:

Loading a template

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 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.

Index lookups

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.

HTML forms

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.

Usage

Topic guide Templates Support for template engines

If you call get_template('story_detail.html'), here are the files Django will look for, in order: /home/html/example.com/story_detail.html ('django' engine) /home/html/default/story_detail.html ('django' engine) /home/html/jinja2/story_detail.html ('jinja2' engine) If you call select_template(['story_253_detail.html', 'story_detail.html']), here’s what Django will look for: /home/html/example.com/story_253_detail.html ('django' engine) /home/html/default/story_253_detail.html ('django' engine) …

Membership

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.

Membership

Internals Organization of the Django Project Steering council

The steering council selects Releasers 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 Releaser.

OSGeo4W

Reference GeoDjango Installation Platform-specific instructionsWindows

The OSGeo4W installer helps to install the PROJ, GDAL, and GEOS libraries required by GeoDjango. First, download the OSGeo4W installer, and run it. Select Express Web-GIS Install and click next. In the ‘Select Packages’ list, ensure that GDAL is selected.

Storage backends

Reference The messages framework Configuring the message engine

The messages framework can use different backends to store temporary messages. Django provides three built-in storage classes in django.contrib.messages: classstorage.session.SessionStorage : This class stores all messages inside of the request’s session. Therefore it requires Django’s contrib.sessions application.