djangodocs.org

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

Definitions

Topic guide Internationalization and localization

localization Writing the translations and local formats. Usually done by translators. More details can be found in the W3C Web Internationalization FAQ, the Wikipedia article or the GNU gettext documentation. WARNING: Translation is controlled by the USE_I18N setting.

4.2 5.0 5.1 5.2 6.0

Code

Topic guide Time zones Migration guide

Since Django now gives you aware datetimes, you’ll get exceptions wherever you compare a datetime that comes from a model or a form with a naive datetime that you’ve created in your code.

4.2 5.0 5.1 5.2 6.0

Troubleshooting

Topic guide Time zones FAQ

… your code is comparing these two things: a datetime provided by Django – for instance, a value read from a form or a model field. Since you enabled time zone support, it’s aware. a datetime generated by your code, which …

4.2 5.0 5.1 5.2 6.0

Cryptographic signing

Topic guide

Ensuring data stored in hidden form fields has not been tampered with. Generating one-time secret URLs for allowing temporary access to a protected resource, for example a downloadable file that a user has paid for.

4.2 5.0 5.1 5.2 6.0

Isolating apps

Topic guide Testing tools Test cases features

utils.isolate_apps(*app_labels,attr_name=None,kwarg_name=None) : Registers the models defined within a wrapped context into their own isolated apps registry.

4.2 5.0 5.1 5.2 6.0

1.6

Internals Django Deprecation Timeline

They will be removed. The form wizard has been refactored to use class-based views with pluggable backends in 1.4. The previous implementation will be removed. Legacy ways of calling cache_page() will be removed.

5.2 6.0

Topic guide Making queries Querying JSONField

… based on a given dictionary key, use that key as the lookup name: Multiple keys can be chained together to form a path lookup: If the key is an integer, it will be interpreted as an index transform in an …

4.2 5.0 5.1 5.2

1.7

Internals Django Deprecation Timeline

The undocumented check_for_test_cookie method in AuthenticationForm will be removed following an accelerated deprecation. Users subclassing this form should remove calls to this method, and instead ensure that their auth related views are CSRF protected, which ensures that cookies are enabled.

5.0 5.1 5.2 6.0

Arguments

Reference Model field reference Relationship fieldsManyToManyField

ForeignKey.related_name : The name to use for the relation from the related object back to this one. It’s also the default value for related_query_name (the name to use for the reverse filter name from the target model).

4.2 5.0 5.1

Field API reference

Reference Model field reference

classField[source] : Field is an abstract class that represents a database table column. Django uses fields to create the database table (db_type()), to map Python types to database (get_prep_value()) and vice-versa (from_db_value()).

4.2 5.0 5.1 5.2 6.0

1.7

Internals Django Deprecation Timeline

The undocumented check_for_test_cookie method in AuthenticationForm will be removed following an accelerated deprecation. Users subclassing this form should remove calls to this method, and instead ensure that their auth related views are CSRF protected, which ensures that cookies are enabled.

4.2 5.0 5.1 5.2

O

Index

… opclasses (Index attribute) - (UniqueConstraint attribute) - open() (FieldFile method) - (File method) - (Storage method) - OpenLayersWidget (class in django.contrib.gis.forms.widgets) - OperationalError - OperationCategory (class in django.db.migrations.operations.base) - optimizemigration - django-admin command - optimizemigration command line option - --check …

Nonce config

How-to How to use Django’s Content Security Policy

To use nonces in your CSP policy, beside the basic config, you need to: Include the NONCE placeholder value in the CSP settings. This only applies to script-src or style-src directives: Add the csp() context processor to your TEMPLATES setting.

dev

5.0

Internals Django Deprecation Timeline

The undocumented BaseForm._html_output() method will be removed. The ability to return a str, rather than a SafeString, when rendering an ErrorDict and ErrorList will be removed. See the Django 4.1 release notes for more details on these changes.

dev

1.10

Internals Django Deprecation Timeline

The following private APIs will be removed from django.db.models.options.Options (Model._meta): get_field_by_name() get_all_field_names() get_fields_with_model() get_concrete_fields_with_model() get_m2m_with_model() get_all_related_objects() get_all_related_objects_with_model() get_all_related_many_to_many_objects() get_all_related_m2m_objects_with_model() The error_message argument of django.forms.RegexField will be removed. The unordered_list filter will no longer support old style lists.

dev

1.9

Internals Django Deprecation Timeline

The model and form IPAddressField will be removed. A stub field will remain for compatibility with historical migrations. AppCommand.handle_app() will no longer be supported. RequestSite and get_current_site() will no longer be importable from django.contrib.sites.models.

dev