djangodocs.org

669 sections in Django 5.1 Search all versions →

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.

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:

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.

Uploading multiple files

Topic guide File Uploads Basic 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.

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.

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.

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.

Field deconstruction

How-to How to create custom model fields Writing a field subclass

It’s used during model migrations to tell Django how to take an instance of your new field and reduce it to a serialized form - in particular, what arguments to pass to __init__() to recreate it.

Inclusion tags

How-to How to create custom template tags and filters Writing custom template tags

django.template.Library.inclusion_tag() Another common type of template tag is the type that displays some data by rendering another template. For example, Django’s admin interface uses custom template tags to display the buttons along the bottom of the “add/change” form pages.

Django documentation

Django offers a robust internationalization and localization framework to assist you in the development of applications for multiple languages and world regions: Overview | Internationalization | Localization | Localized web UI formatting and form input Time zones

6.0

Internals Django Deprecation Timeline

The DjangoDivFormRenderer and Jinja2DivFormRenderer transitional form renderers will be removed. Support for passing positional arguments to BaseConstraint will be removed. request will be required in the signature of ModelAdmin.lookup_allowed() subclasses. The django.db.models.sql.datastructures.Join will no longer fallback to get_joining_columns().

Official releases

Internals Django’s release process

Since version 1.0, Django’s release numbering works as follows: Versions are numbered in the form A.B or A.B.C. A.B is the feature release version number. Each version will be mostly backwards compatible with the previous release.

Tutorial

We’re continuing the web-poll application and will focus on form processing and cutting down our code. NOTE: If you’re having trouble going through this tutorial, please head over to > the Getting Help section of the FAQ.

FormView

Reference Class-based generic views - flattened index Editing views

classFormView Attributes (with optional accessor): content_type extra_context form_class [get_form_class()] http_method_names initial [get_initial()] prefix [get_prefix()] response_class [render_to_response()] success_url [get_success_url()] template_engine template_name [get_template_names()] Methods as_view() dispatch() form_invalid() form_valid() get() get_context_data() get_form() get_form_kwargs() http_method_not_allowed() post() put() setup()