Topic guide Multiple databases Manually selecting a database
You can select the database for a QuerySet at any point in the QuerySet “chain.” Call using() on the QuerySet to get another QuerySet that uses the specified database.
241 sections in Django 5.0 Search all versions →
Topic guide Multiple databases Manually selecting a database
You can select the database for a QuerySet at any point in the QuerySet “chain.” Call using() on the QuerySet to get another QuerySet that uses the specified database.
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.
Reference QuerySet API reference QuerySet APIField lookups
Greater than. Example: SQL equivalent:
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'
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.
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.
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.
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.
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.
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.
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.
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.
Make sure your Django DEBUG setting is set to True. Then do this: connection.queries is only available if DEBUG is True. It’s a list of dictionaries in order of query execution.
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.
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:
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:
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:
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:
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:
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: