djangodocs.org

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

Uploading multiple files

Topic guide File uploads

If you want to upload multiple files using one form field, create a subclass of the field’s widget and set its allow_multiple_selected class attribute to True.

dev

help_text

Reference Model field reference Field options

Field.help_text Extra “help” text to be displayed with the form widget. It’s useful for documentation even if your field isn’t used on a form. Note that this value is not HTML-escaped in automatically-generated forms.

4.2 5.0 5.1 5.2 6.0

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.

4.2 5.0 5.1 5.2 6.0

Topic guide Working with forms Working with form templates

However, it can also be directly accessed from the field attribute on the form. For example: Complete <label> elements can also be generated using the label_tag(). For example:

4.2 5.0 5.1 5.2 6.0

Topic guide Working with forms Working with form templatesLooping over the form’s fields

If you’re manually laying out a form in a template, as opposed to relying on Django’s default form layout, you might want to treat <input type="hidden"> fields differently from non-hidden fields.

4.2 5.0 5.1 5.2 6.0

Customizing BoundField

Reference The Forms API

If you need to access some additional information about a form field in a template and using a subclass of Field isn’t sufficient, consider also customizing BoundField.

4.2 5.0 5.1

Reference Middleware Available middleware

classCsrfViewMiddleware[source] Adds protection against Cross Site Request Forgeries by adding hidden form fields to POST forms and checking requests for the correct value. See the Cross Site Request Forgery protection documentation.

4.2 5.0 5.1 5.2 6.0

Handling pull requests

Internals Committing code

Since Django is hosted on GitHub, patches are provided in the form of pull requests. When committing a pull request, make sure each individual commit matches the commit guidelines described below.

dev

Reference Settings

Default: 100 The maximum number of files that may be received via POST in a multipart/form-data encoded request before a SuspiciousOperation (TooManyFiles) is raised. You can set this to None to disable the check.

dev

Handling pull requests

Internals Committing code

Since Django is hosted on GitHub, patches are provided in the form of pull requests. When committing a pull request, make sure each individual commit matches the commit guidelines described below.

4.2 5.0 5.1 5.2 6.0

Release cadence

Internals Django’s release process

Starting with Django 2.0, version numbers will use a loose form of semantic versioning such that each version following an LTS will bump to the next “dot zero” version. For example: 2.0, 2.1, 2.2 (LTS), 3.0, 3.1, 3.2 (LTS), etc.

4.2 5.0 5.1 5.2 6.0

max_geom_collections

Reference GeoDjango Model API Geometry Field Options

GeometryField.max_geom_collections New in Django 5.2.17. This option is forwarded to the form field generated for this model field, bounding the geometry collection nesting depth in submitted WKB/WKT inputs before raising ValueError.

5.2 6.0

Reference Settings Core Settings

Default: 100 The maximum number of files that may be received via POST in a multipart/form-data encoded request before a SuspiciousOperation (TooManyFiles) is raised. You can set this to None to disable the check.

4.2 5.0 5.1 5.2 6.0