djangodocs.org

711 sections in Django dev Search all versions →

Compiling message files

Topic guide Translation

After you create your message file – and each time you make changes to it – you’ll need to compile it into a more efficient form, for use by gettext. Do this with the django-admin compilemessages utility.

Clickjacking protection

Topic guide Security in Django

Clickjacking is a type of attack where a malicious site wraps another site in a frame. This attack can result in an unsuspecting user being tricked into performing unintended actions on the target site.

DjangoJSONEncoder

Topic guide Serializing Django objects

A subclass of JSONEncoder, it handles these additional types: datetime A string of the form YYYY-MM-DDTHH:mm:ss.sssZ or YYYY-MM-DDTHH:mm:ss.sss+HH:MM as defined in ECMA-262. date A string of the form YYYY-MM-DD as defined in ECMA-262.

H

Index

… django.conf.urls) - has_add_permission() (InlineModelAdmin method) - (ModelAdmin method) - has_change_permission() (InlineModelAdmin method) - (ModelAdmin method) - has_changed() (Field method) - (Form method) - has_curve (OGRGeometry attribute) - has_delete_permission() (InlineModelAdmin method) - (ModelAdmin method) - has_error() (Form method) - has_header() (HttpResponse …

L

Index

… (BoundField attribute) - (Field attribute) - (LabelCommand attribute) - (Options attribute) - label_lower (Options attribute) - label_suffix (Field attribute) - (Form attribute) - label_tag() (BoundField method) - LabelCommand (class in django.core.management) - labels (ModelFormOptions attribute) - Lag (class in django.db.models.functions) …

How-to

… can use csrf_protect() on particular views you want to protect (see below). 2. In any template that uses a POST form, use the csrf_token tag inside the <form> element if the form is for an internal URL, e.g.: This should …

How-to How to configure and use logging

… with the records they receive filters, to provide additional control over the transfer of records, and even modify records in-place formatters, to convert LogRecord objects to a string or other form for consumption by human beings or another system There …

Committing guidelines

Internals Committing code

… in RSS API.” Incorrect: “Fixes Unicode bug in RSS API.” (present tense) Incorrect: “Fixing Unicode bug in RSS API.” (“-ing” form) Incorrect: “Fixed Unicode bug in RSS API” (missing trailing period) The commit message should be in lines of 72 …

Communication channels

Internals Contributing to Django

Join it, to become familiar with what we’re doing and how we talk about it. You’ll be able to form relationships with more experienced contributors who are there to help guide you towards success.

Keywords

Internals Triaging tickets

Keyword search finds the keyword string anywhere in the keywords. For example, clicking on a ticket with the keyword “form” will yield similar tickets tagged with keywords containing strings such as “formset”, “modelformset”, and “ManagementForm”.

Documentation lint check

Internals Writing documentation

Django’s documentation is checked for reStructuredText style and formal issues using sphinx-lint. This helps catch problems like stray tabs, trailing whitespace, excessive line length, and similar formatting problems.

1.5

Internals Django Deprecation Timeline

The undocumented function django.contrib.formtools.utils.security_hash will be removed, instead use django.contrib.formtools.utils.form_hmac The function-based generic view modules will be removed in favor of their class-based equivalents, outlined here. The django.core.servers.basehttp.AdminMediaHandler will be removed. In its place use django.contrib.staticfiles.handlers.StaticFilesHandler.

Internals Django’s security policy

… sanitized: Developers must always validate and sanitize input before using it. The correct approach would be to use a Django form to ensure email is properly validated: Similarly, as Django’s raw SQL constructs (such as extra(), RawSQL, and keyword arguments …

Overview

Tutorial Writing your first Django app, part 3

Question “detail” page – displays a question text, with no results but with a form to vote. Question “results” page – displays results for a particular question. Vote action – handles voting for a particular choice in a particular question.

Adding related objects

Tutorial Writing your first Django app, part 7

The “Add choice” form looks like this: In that form, the “Question” field is a select box containing every question in the database. Django knows that a ForeignKey should be represented in the admin as a <select> box.