djangodocs.org

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

DjangoJSONEncoder

Topic guide Serializing Django objects Serialization formatsJSON

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.

4.2 5.0 5.1 5.2 6.0

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().

4.2 5.2

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().

5.0 5.1

DateTimeField

Reference Model field reference Field types

Takes the same extra arguments as DateField. The default form widget for this field is a single DateTimeInput. The admin uses two separate TextInput widgets with JavaScript shortcuts. WARNING: Always use DateTimeField with a datetime.datetime > instance.

4.2 5.0 5.1 5.2 6.0

GenericIPAddressField

Reference Model field reference Field types

classGenericIPAddressField(protocol='both',unpack_ipv4=False,**options)[source] An IPv4 or IPv6 address, in string format (e.g. 192.0.2.30 or 2a02:42fe::4). The default form widget for this field is a TextInput.

4.2 5.0 5.1 5.2 6.0

Attributes

Reference Request and response objects StreamingHttpResponse objects

HttpRequest.body[source] : The raw HTTP request body as a bytestring. This is useful for processing data in different ways than conventional HTML forms: binary images, XML payload etc. For processing conventional form data, use HttpRequest.POST.

4.2 5.0 5.1 5.2 6.0

ModelForm

Topic guide Creating forms from models

classModelForm[source] If you’re building a database-driven app, chances are you’ll have forms that map closely to Django models. For instance, you might have a BlogComment model, and you want to create a form that lets people submit comments.

4.2 5.0 5.1 5.2 6.0

SimpleTestCase

Topic guide Testing tools Provided test case classes

Testing form field rendering and error treatment. Testing HTML responses for the presence/lack of a given fragment. Verifying that a template has/hasn't been used to generate a given response content. Verifying that two URLs are equal.

4.2 5.0 5.1 5.2 6.0

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 …

dev

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 …

dev

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 …

dev

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.

dev

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”.

dev

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.

dev