djangodocs.org

241 sections in Django 5.0 Search all versions →

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.

RadioSelect

Reference Widgets Built-in widgetsSelector and checkbox widgets

classRadioSelect : - template_name: 'django/forms/widgets/radio.html' - option_template_name: 'django/forms/widgets/radio_option.html'

contains

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive containment test. Example: SQL equivalent: Note this will match the headline 'Lennon honored today' but not 'lennon honored today'. NOTE: SQLite doesn’t support case-sensitive LIKE statements; contains > acts like icontains for SQLite.

icontains

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive containment test. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

startswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive starts-with. Example: SQL equivalent: SQLite doesn’t support case-sensitive LIKE statements; startswith acts like istartswith for SQLite.

istartswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive starts-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

endswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive ends-with. Example: SQL equivalent: NOTE: SQLite doesn’t support case-sensitive LIKE statements; endswith > acts like iendswith for SQLite. Refer to the database note documentation for more.

iendswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive ends-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

Deferring model fields

Topic guide Performing raw SQL queries Performing raw queries

Fields may also be left out: The Person objects returned by this query will be deferred model instances (see defer()). This means that the fields that are omitted from the query will be loaded on demand.

can_delete

Topic guide Formsets Dealing with ordering and deletion of forms

BaseFormSet.can_delete Default: False Lets you create a formset with the ability to select forms for deletion: Similar to can_order this adds a new field to each form named DELETE and is a forms.BooleanField.

Admin actions

Reference

The basic workflow of Django’s admin is, in a nutshell, “select an object, then change it.” This works well for a majority of use cases.

left

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box is strictly to the left of the lookup geometry’s bounding box. Example: PostGIS equivalent:

right

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box is strictly to the right of the lookup geometry’s bounding box. Example: PostGIS equivalent:

overlaps_left

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Bilateral) Tests if the geometry field’s bounding box overlaps or is to the left of the lookup geometry’s bounding box. Example: PostGIS equivalent:

overlaps_right

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Bilateral) Tests if the geometry field’s bounding box overlaps or is to the right of the lookup geometry’s bounding box. Example: PostGIS equivalent:

overlaps_above

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box overlaps or is above the lookup geometry’s bounding box. Example: PostGIS equivalent:

overlaps_below

Reference GIS QuerySet API Reference Spatial Lookups

Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box overlaps or is below the lookup geometry’s bounding box. Example: PostGIS equivalent: