| Age | Commit message (Collapse) | Author |
|
This change implements DEP 16: to rename the django-admin command to django.
django-admin is kept as an alias.
Docs references to the "django-admin" command are updated to "django" or
“The django command”.
Renamed the `django-admin` Sphinx directive to `cmd`, and the
`django-admin-option` directive to `cli-option`.
Thanks Johannes Maron, Mike Edmunds, and Jacob Walls for reviews.
|
|
values.
|
|
disable multiline template tags.
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
|
|
QUERY (RFC 10008) is a safe, idempotent method that carries the query in
the request content rather than in the URI's query component. Treat it as
safe throughout: exempt it from CSRF protection, evaluate request
preconditions as for GET, accept it in require_safe(), and dispatch it
from View. Query content is available as HttpRequest.body and is not
parsed into HttpRequest.POST.
Caching is left for a follow-up. Per RFC 10008 Section 2.7 the cache key
for a QUERY request must incorporate the request content, which the cache
middleware and cache_page() don't do, so they continue to ignore QUERY.
Thanks Ben Atkinson, Jonathan Biemond, and Jacob Walls for reviews.
|
|
functools.cached_property.
Since Python 3.12, `functools.cached_property` no longer takes a lock
(https://github.com/python/cpython/issues/87634), which was the main
objection to using it instead of Django's own implementation.
`Prefetch(to_attr=...)` and the admindocs model detail page now accept
`functools.cached_property` as well as Django's own `cached_property`.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
|
|
The docs home page used "Overview" as the link text 15 times, the only
duplicated link text on that page. A reader navigating by a list of
links got identical entries with no indication of which section each
belonged to. A sixteenth "Overview" comes from the main site's navbar
and is outside this repository.
Every one of those targets already has a distinct title of its own,
which `docs/index.txt` was overriding with the generic word. Most of
them now use it, via `:doc:` without an explicit title. Three would have
repeated their group label, and are given a short unique title instead.
Also retitled five of those documents so that the home page can use their
own titles: two to sentence case, matching the rest, and three to drop a
redundant "in Django" suffix.
|
|
|
|
|
|
|
|
The currentmodule directive used django.db.backends.base.DatabaseWrapper,
which is not a real module path. Documented the method on the public
django.db.connection object instead, consistent with the cache docs.
Also indented the method description so it renders as the method body.
Thanks Tim Graham for the review and Tim Schilling for the ticket.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
Address is the safe way to build an email address with a display name
from variable parts (see #34753), but `ADMINS` and `MANAGERS` rejected
non-string values, so it could not be used there. This branch allows
`Address` instances in those settings, documents, and tests the support
already present in `DEFAULT_FROM_EMAIL`, `SERVER_EMAIL`, `send_mail()`,
`send_mass_mail()`, and `EmailMessage`.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
docs pages.
|
|
Relying on MiddlewareMixin.__acall__() to handle async requests imposed
per-middleware context switching, defeating BaseHandler's intent
to transition only once per middleware chain.
To minimize breaking changes, MiddlewareMixin's default value did not
change: only the values on Django's own subclasses. Use cases where the
prior behavior is preferable (in order to avoid pinning a thread per
request) are fleshed out in docs.
Thanks Mykhailo Havelia for the report.
|
|
Tutorial 2 interrupted the makemigrations/migrate narrative with a long
sqlmigrate digression and a list of schema conventions. The command, its
example output, and those notes now live where readers look for them:
* docs/topics/migrations.txt gained an "Executing sqlmigrate" section,
with the books models the example SQL is generated from.
* docs/topics/db/models.txt absorbed the notes on table naming and on
Django tailoring SQL to the database backend.
* Tutorial 2 now links to the migrations topic for the details.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
|
|
Updated references to RemovedInDjango70Warning to use the new warning,
and adjusted references to "Django 7.0" to "Django 2028".
RemovedInDjango70Warning remains importable as an alias of the same
class, so existing warning filters and except clauses in third-party
code keep working across the rename.
|
|
|
|
async_client in testing tools.
|
|
This aims for consistency in the django.db.models namespace.
Thanks Natalia Bidart and Simon Charette for the idea.
|
|
* Moved versionadded annotation to top of `mailers` section.
* Added versionadded to `mailers.default` to help avoid confusion over
deprecated annotation in same entry.
* Added missing "a" in `get_connection()` deprecation note.
|
|
Thanks to these people for pointing these out:
* Hojeong Park
* Natalia Bidart
* Sulav Raj Bista
|
|
middleware runs.
|
|
|
|
|
|
Co-authored-by: Daniele Procida <evildmp@users.noreply.github.com>
Co-authored-by: James Bligh <blighj@users.noreply.github.com>
|
|
|
|
see for details.
|
|
Reworked the outdated "Preventing header injection" section:
* Added a "Safely sending email" section noting that the topic is
relevant but beyond the scope of Django's own docs.
* Added a section on correctly formatting email addresses with a
variable display name to avoid injection attacks.
* Updated the existing "Preventing header injection" section to note
that Django (via Python) already prevents CRLF injection, but that
custom email backends that bypass Django's protections may need to
handle it.
Also added references to the new "Formatting email addresses" section
from the `ADMINS`, `DEFAULT_FROM_EMAIL`, and `SERVER_EMAIL` settings.
|
|
Updated the `ContactForm` examples in the "Forms" topic and reference
docs to avoid broken and unsafe practices around sending email:
* Stopped using user-provided `sender` address as `from_email`. Instead,
renamed to `contact_email` and used it as the `reply_to` address.
* Removed `cc_myself` option to prevent using the form to send spam.
Substituted an `urgent` field to demonstrate `BooleanField` use.
* Identified email as coming from the contact form and added other
content to reduce impersonation/phishing risks.
Also updated some example output in the forms reference docs where it
had drifted from the example code over time: email fields default to
`maxlength=320`; the `ContactForm` example has been using a `TextArea`
widget for its message field.
|
|
Replaced "plain-text" with "plaintext" where it is used to describe the
unencrypted input to a password hashing function. (In a cryptography
context this is the preferred spelling, and it is already used that way
in Django's release notes.) This reduces ambiguity about whether
make_password() expects UTF-8 encoded Unicode text ("plain-text bytes")
or the unencrypted material for the user's password ("plaintext bytes").
(See #37184.)
All other current uses of "plain text" and "plain-text" in docs and
docstrings (including the one elsewhere in passwords.txt) are describing
text that is plain (unformatted; not rich text).
|
|
|
|
|
|
Removed outdated warnings, and updated performance considerations to
reflect current realities.
Thanks to Mykhailo Havelia for the detailed review.
|
|
Bcc addresses are sent via the SMTP envelope and must never appear in
the message itself. A "Bcc" key in `extra_headers` was not excluded like
From/To/Cc/Reply-To, so it leaked into the generated message as a
visible header.
Thanks Mike Edmunds for reviews.
|
|
|
|
|
|
Revises the AnimalTestCase to better show test data isolation
and avoid the opportunity to use setUpTestData.
|
|
|
|
(a)force_login().
Co-authored-by: Mykhailo Havelia <Arfey17.mg@gmail.com>
|
|
|
|
responses.
Thanks Shai Berger for the report, and Natalia Bidart and Sarah Boyce for reviews.
|
|
Obsolete since 330638b89f14e1fb06e9d313ccc9768ae167c53f.
|
|
|
|
|
|
|
|
This makes the name consistent with the `savepoint_commit` and
`savepoint_rollback` functions. The previous name is maintained as a
deprecated alias.
This also frees up the `savepoint` name, which would allow the context
manager from `django-subatomic` to be included in Django.
Co-authored-by: Lily <code@lilyf.org>
|
|
* Fixed typos related to automated EMAIL_PROVIDERS -> MAILERS renaming.
* Clarified wording in some recently added/updated sections.
* Removed deprecated, extraneous `fail_silently=False` from examples.
* Moved EmailBackend API documentation out of "Email backends" intro
into a dedicated section in email.txt.
* Sorted MAILERS alphabetically in settings.txt.
|
|
See DEP 0018.
Added:
* MAILERS setting.
* django.core.mail.mailers dict-like EmailBackend factory.
* `using` argument to mail sending APIs.
* `sent_using` attribute to mail.outbox messages in locmem backend.
* MAILERS in startproject settings template, set to console backend.
* AdminLogHandler.using argument.
* BrokenLinkEmailsMiddleware.send_mail() method.
Updated:
* BaseEmailBackend to track the MAILERS alias used to construct it, and
to report errors for unknown kwargs (OPTIONS).
* EmailBackend implementations to initialize from kwargs (OPTIONS) only
when MAILERS is being used.
* smtp.EmailBackend to require `host` option and to default `port`
option based on SSL/TLS options.
* SimpleTestCase setup to substitute the locmem backend for all defined
MAILERS configurations.
* Django's tests that send mail to define MAILERS.
Deprecated:
* EMAIL_BACKEND and other backend-related EMAIL_* settings.
* mail.get_connection().
* The `connection`, `fail_silently`, `auth_user`, and `auth_password`
arguments to mail functions.
* The EmailMessage.connection attribute.
* BaseEmailBackend support for `fail_silently`. Backends that support
fail_silently (SMTP, console, file) now implement it directly.
* AdminEmailHandler.email_backend argument.
Removed undocumented features without deprecation:
* EmailMessage.get_connection() method. (send() now raises an error if a
subclass has attempted to override it.)
* EmailMessage.send() no longer sets self.connection to the connection
used for sending. (It still _uses_ a pre-existing self.connection.)
* AdminEmailHandler.connection() method. (Init now raises an error if a
subclass has attempted to override it.)
Thanks to Natalia Bidart for shepherding DEP 0018 and for extensive
reviews and suggestions on the implementation.
Thanks to Jacob Rief for the initial implementation and multiple
iterations while refining the design.
Co-authored-by: Jacob Rief <jacob.rief@gmail.com>
|
|
|