mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Used extlinks for PyPI links.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
parent
255f534590
commit
2c4dc64760
@ -134,6 +134,7 @@ extlinks = {
|
||||
"bpo": ("https://bugs.python.org/issue?@action=redirect&bpo=%s", "bpo-%s"),
|
||||
"commit": ("https://github.com/django/django/commit/%s", "%s"),
|
||||
"cve": ("https://nvd.nist.gov/vuln/detail/CVE-%s", "CVE-%s"),
|
||||
"pypi": ("https://pypi.org/project/%s/", "%s"),
|
||||
# A file or directory. GitHub redirects from blob to tree if needed.
|
||||
"source": ("https://github.com/django/django/blob/main/%s", "%s"),
|
||||
"ticket": ("https://code.djangoproject.com/ticket/%s", "#%s"),
|
||||
|
@ -2,10 +2,8 @@
|
||||
How to use Django with Daphne
|
||||
=============================
|
||||
|
||||
Daphne_ is a pure-Python ASGI server for UNIX, maintained by members of the
|
||||
Django project. It acts as the reference server for ASGI.
|
||||
|
||||
.. _Daphne: https://pypi.org/project/daphne/
|
||||
:pypi:`Daphne <daphne>` is a pure-Python ASGI server for UNIX, maintained by
|
||||
members of the Django project. It acts as the reference server for ASGI.
|
||||
|
||||
Installing Daphne
|
||||
===================
|
||||
|
@ -20,8 +20,8 @@ participating in a March Madness contest.
|
||||
Install ReportLab
|
||||
=================
|
||||
|
||||
The ReportLab library is `available on PyPI`_. A `user guide`_ (not
|
||||
coincidentally, a PDF file) is also available for download.
|
||||
The ReportLab library is :pypi:`available on PyPI <reportlab>`. A `user guide`_
|
||||
(not coincidentally, a PDF file) is also available for download.
|
||||
You can install ReportLab with ``pip``:
|
||||
|
||||
.. console::
|
||||
@ -36,7 +36,6 @@ Test your installation by importing it in the Python interactive interpreter:
|
||||
|
||||
If that command doesn't raise any errors, the installation worked.
|
||||
|
||||
.. _available on PyPI: https://pypi.org/project/reportlab/
|
||||
.. _user guide: https://www.reportlab.com/docs/reportlab-userguide.pdf
|
||||
|
||||
Write your view
|
||||
|
@ -39,13 +39,11 @@ matches the version you installed by executing:
|
||||
About ``pip``
|
||||
=============
|
||||
|
||||
`pip`_ is a package manager for Python and is included by default with the
|
||||
:pypi:`pip` is a package manager for Python and is included by default with the
|
||||
Python installer. It helps to install and uninstall Python packages
|
||||
(such as Django!). For the rest of the installation, we'll use ``pip`` to
|
||||
install Python packages from the command line.
|
||||
|
||||
.. _pip: https://pypi.org/project/pip/
|
||||
|
||||
.. _virtualenvironment:
|
||||
|
||||
Setting up a virtual environment
|
||||
@ -105,8 +103,8 @@ terminal. In modern terminals this should work for both CMD and PowerShell. If
|
||||
for some reason this needs to be disabled, set the environmental variable
|
||||
:envvar:`DJANGO_COLORS` to ``nocolor``.
|
||||
|
||||
On older Windows versions, or legacy terminals, colorama_ must be installed to
|
||||
enable syntax coloring:
|
||||
On older Windows versions, or legacy terminals, :pypi:`colorama` must be
|
||||
installed to enable syntax coloring:
|
||||
|
||||
.. code-block:: doscon
|
||||
|
||||
@ -114,8 +112,6 @@ enable syntax coloring:
|
||||
|
||||
See :ref:`syntax-coloring` for more information on color settings.
|
||||
|
||||
.. _colorama: https://pypi.org/project/colorama/
|
||||
|
||||
Common pitfalls
|
||||
===============
|
||||
|
||||
|
@ -45,12 +45,12 @@ Python style
|
||||
|
||||
* Unless otherwise specified, follow :pep:`8`.
|
||||
|
||||
Use `flake8`_ to check for problems in this area. Note that our ``setup.cfg``
|
||||
file contains some excluded files (deprecated modules we don't care about
|
||||
cleaning up and some third-party code that Django vendors) as well as some
|
||||
excluded errors that we don't consider as gross violations. Remember that
|
||||
:pep:`8` is only a guide, so respect the style of the surrounding code as a
|
||||
primary goal.
|
||||
Use :pypi:`flake8` to check for problems in this area. Note that our
|
||||
``setup.cfg`` file contains some excluded files (deprecated modules we don't
|
||||
care about cleaning up and some third-party code that Django vendors) as well
|
||||
as some excluded errors that we don't consider as gross violations. Remember
|
||||
that :pep:`8` is only a guide, so respect the style of the surrounding code
|
||||
as a primary goal.
|
||||
|
||||
An exception to :pep:`8` is our rules on line lengths. Don't limit lines of
|
||||
code to 79 characters if it means the code looks significantly uglier or is
|
||||
@ -352,8 +352,8 @@ Miscellaneous
|
||||
documentation </topics/i18n/index>` for details.
|
||||
|
||||
* Remove ``import`` statements that are no longer used when you change code.
|
||||
`flake8`_ will identify these imports for you. If an unused import needs to
|
||||
remain for backwards-compatibility, mark the end of with ``# NOQA`` to
|
||||
:pypi:`flake8` will identify these imports for you. If an unused import needs
|
||||
to remain for backwards-compatibility, mark the end of with ``# NOQA`` to
|
||||
silence the flake8 warning.
|
||||
|
||||
* Systematically remove all trailing whitespaces from your code as those
|
||||
@ -376,4 +376,3 @@ For details about the JavaScript code style used by Django, see
|
||||
|
||||
.. _black: https://black.readthedocs.io/en/stable/
|
||||
.. _editorconfig: https://editorconfig.org/
|
||||
.. _flake8: https://pypi.org/project/flake8/
|
||||
|
@ -251,7 +251,7 @@ Running the Selenium tests
|
||||
--------------------------
|
||||
|
||||
Some tests require Selenium and a web browser. To run these tests, you must
|
||||
install the selenium_ package and run the tests with the
|
||||
install the :pypi:`selenium` package and run the tests with the
|
||||
``--selenium=<BROWSERS>`` option. For example, if you have Firefox and Google
|
||||
Chrome installed:
|
||||
|
||||
@ -277,28 +277,31 @@ Running all the tests
|
||||
If you want to run the full suite of tests, you'll need to install a number of
|
||||
dependencies:
|
||||
|
||||
* aiosmtpd_
|
||||
* argon2-cffi_ 19.2.0+
|
||||
* asgiref_ 3.6.0+ (required)
|
||||
* bcrypt_
|
||||
* colorama_
|
||||
* docutils_
|
||||
* geoip2_
|
||||
* jinja2_ 2.11+
|
||||
* numpy_
|
||||
* Pillow_ 6.2.1+
|
||||
* PyYAML_
|
||||
* pytz_ (required)
|
||||
* pywatchman_
|
||||
* redis_ 3.4+
|
||||
* setuptools_
|
||||
* memcached_, plus a :ref:`supported Python binding <memcached>`
|
||||
* gettext_ (:ref:`gettext_on_windows`)
|
||||
* selenium_
|
||||
* sqlparse_ 0.3.1+ (required)
|
||||
* tblib_ 1.5.0+
|
||||
* :pypi:`aiosmtpd`
|
||||
* :pypi:`argon2-cffi` 19.2.0+
|
||||
* :pypi:`asgiref` 3.6.0+ (required)
|
||||
* :pypi:`bcrypt`
|
||||
* :pypi:`colorama`
|
||||
* :pypi:`docutils`
|
||||
* :pypi:`geoip2`
|
||||
* :pypi:`Jinja2` 2.11+
|
||||
* :pypi:`numpy`
|
||||
* :pypi:`Pillow` 6.2.1+
|
||||
* :pypi:`PyYAML`
|
||||
* :pypi:`pytz` (required)
|
||||
* :pypi:`pywatchman`
|
||||
* :pypi:`redis` 3.4+
|
||||
* :pypi:`setuptools`
|
||||
* :pypi:`memcached`, plus a `supported Python binding
|
||||
<https://memcached.org/>`_
|
||||
* `gettext <https://www.gnu.org/software/gettext/manual/gettext.html>`_
|
||||
(:ref:`gettext_on_windows`)
|
||||
* :pypi:`selenium`
|
||||
* :pypi:`sqlparse` 0.3.1+ (required)
|
||||
* :pypi:`tblib` 1.5.0+
|
||||
|
||||
You can find these dependencies in `pip requirements files`_ inside the
|
||||
You can find these dependencies in `pip requirements files
|
||||
<https://pip.pypa.io/en/latest/user_guide/#requirements-files>`_ inside the
|
||||
``tests/requirements`` directory of the Django source tree and install them
|
||||
like so:
|
||||
|
||||
@ -324,31 +327,8 @@ and install the Geospatial libraries</ref/contrib/gis/install/index>`.
|
||||
Each of these dependencies is optional. If you're missing any of them, the
|
||||
associated tests will be skipped.
|
||||
|
||||
To run some of the autoreload tests, you'll need to install the Watchman_
|
||||
service.
|
||||
|
||||
.. _aiosmtpd: https://pypi.org/project/aiosmtpd/
|
||||
.. _argon2-cffi: https://pypi.org/project/argon2-cffi/
|
||||
.. _asgiref: https://pypi.org/project/asgiref/
|
||||
.. _bcrypt: https://pypi.org/project/bcrypt/
|
||||
.. _colorama: https://pypi.org/project/colorama/
|
||||
.. _docutils: https://pypi.org/project/docutils/
|
||||
.. _geoip2: https://pypi.org/project/geoip2/
|
||||
.. _jinja2: https://pypi.org/project/Jinja2/
|
||||
.. _numpy: https://pypi.org/project/numpy/
|
||||
.. _Pillow: https://pypi.org/project/Pillow/
|
||||
.. _PyYAML: https://pyyaml.org/wiki/PyYAML
|
||||
.. _pytz: https://pypi.org/project/pytz/
|
||||
.. _pywatchman: https://pypi.org/project/pywatchman/
|
||||
.. _redis: https://pypi.org/project/redis/
|
||||
.. _setuptools: https://pypi.org/project/setuptools/
|
||||
.. _memcached: https://memcached.org/
|
||||
.. _gettext: https://www.gnu.org/software/gettext/manual/gettext.html
|
||||
.. _selenium: https://pypi.org/project/selenium/
|
||||
.. _sqlparse: https://pypi.org/project/sqlparse/
|
||||
.. _pip requirements files: https://pip.pypa.io/en/latest/user_guide/#requirements-files
|
||||
.. _tblib: https://pypi.org/project/tblib/
|
||||
.. _Watchman: https://facebook.github.io/watchman/
|
||||
To run some of the autoreload tests, you'll need to install the
|
||||
`Watchman <https://facebook.github.io/watchman/>`_ service.
|
||||
|
||||
Code coverage
|
||||
-------------
|
||||
|
@ -211,7 +211,7 @@ documentation:
|
||||
"last bit" of that path. So ``:mod:`~django.contrib.auth``` will
|
||||
display a link with the title "auth".
|
||||
|
||||
* All Python code blocks should be formatted using the `blacken-docs`_
|
||||
* All Python code blocks should be formatted using the :pypi:`blacken-docs`
|
||||
auto-formatter. This will be run by ``pre-commit`` if that is configured.
|
||||
|
||||
* Use :mod:`~sphinx.ext.intersphinx` to reference Python's and Sphinx'
|
||||
@ -264,9 +264,7 @@ documentation:
|
||||
.. versionchanged:: 4.2
|
||||
|
||||
All Python code blocks in the Django documentation were reformatted with
|
||||
`blacken-docs`_.
|
||||
|
||||
.. _blacken-docs: https://pypi.org/project/blacken-docs/
|
||||
:pypi:`blacken-docs`.
|
||||
|
||||
Django-specific markup
|
||||
======================
|
||||
@ -536,8 +534,7 @@ Spelling check
|
||||
==============
|
||||
|
||||
Before you commit your docs, it's a good idea to run the spelling checker.
|
||||
You'll need to install `sphinxcontrib-spelling
|
||||
<https://pypi.org/project/sphinxcontrib-spelling/>`_ first. Then from the
|
||||
You'll need to install :pypi:`sphinxcontrib-spelling` first. Then from the
|
||||
``docs`` directory, run ``make spelling``. Wrong words (if any) along with the
|
||||
file and line number where they occur will be saved to
|
||||
``_build/spelling/output.txt``.
|
||||
|
@ -109,15 +109,15 @@ Role
|
||||
----
|
||||
|
||||
Releasers_ are a small set of people who have the authority to upload packaged
|
||||
releases of Django to the `Python Package Index`_, and to the
|
||||
releases of Django to the :pypi:`Python Package Index <Django>` and to the
|
||||
`djangoproject.com`_ website.
|
||||
|
||||
Prerogatives
|
||||
------------
|
||||
|
||||
Releasers_ :doc:`build Django releases </internals/howto-release-django>` and
|
||||
upload them to the `Python Package Index`_, and to the `djangoproject.com`_
|
||||
website.
|
||||
upload them to the :pypi:`Python Package Index <Django>` and to the
|
||||
`djangoproject.com`_ website.
|
||||
|
||||
Membership
|
||||
----------
|
||||
@ -155,7 +155,6 @@ Otherwise, a Releaser may be removed by:
|
||||
of the Django Software Foundation.
|
||||
- A vote of the steering council.
|
||||
|
||||
.. _`Python Package Index`: https://pypi.org/project/Django/
|
||||
.. _djangoproject.com: https://www.djangoproject.com/download/
|
||||
|
||||
.. _steering-council:
|
||||
|
@ -121,9 +121,10 @@ On the day of disclosure, we will take the following steps:
|
||||
|
||||
#. Apply the relevant patch(es) to Django's codebase.
|
||||
|
||||
#. Issue the relevant release(s), by placing new packages on `the
|
||||
Python Package Index`_ and on the Django website, and tagging the
|
||||
new release(s) in Django's git repository.
|
||||
#. Issue the relevant release(s), by placing new packages on the :pypi:`Python
|
||||
Package Index <Django>` and on the `djangoproject.com website
|
||||
<https://www.djangoproject.com/download/>`_, and tagging the new release(s)
|
||||
in Django's git repository.
|
||||
|
||||
#. Post a public entry on `the official Django development blog`_,
|
||||
describing the issue and its resolution in detail, pointing to the
|
||||
@ -133,7 +134,6 @@ On the day of disclosure, we will take the following steps:
|
||||
#. Post a notice to the |django-announce| and oss-security@lists.openwall.com
|
||||
mailing lists that links to the blog post.
|
||||
|
||||
.. _the Python Package Index: https://pypi.org/
|
||||
.. _the official Django development blog: https://www.djangoproject.com/weblog/
|
||||
|
||||
If a reported issue is believed to be particularly time-sensitive --
|
||||
|
@ -107,16 +107,13 @@ Installing some prerequisites
|
||||
=============================
|
||||
|
||||
The current state of Python packaging is a bit muddled with various tools. For
|
||||
this tutorial, we're going to use setuptools_ to build our package. It's the
|
||||
recommended packaging tool (merged with the ``distribute`` fork). We'll also be
|
||||
using `pip`_ to install and uninstall it. You should install these
|
||||
this tutorial, we're going to use :pypi:`setuptools` to build our package. It's
|
||||
the recommended packaging tool (merged with the ``distribute`` fork). We'll
|
||||
also be using :pypi:`pip` to install and uninstall it. You should install these
|
||||
two packages now. If you need help, you can refer to :ref:`how to install
|
||||
Django with pip<installing-official-release>`. You can install ``setuptools``
|
||||
the same way.
|
||||
|
||||
.. _setuptools: https://pypi.org/project/setuptools/
|
||||
.. _pip: https://pypi.org/project/pip/
|
||||
|
||||
Packaging your app
|
||||
==================
|
||||
|
||||
|
@ -9,7 +9,7 @@ The :class:`GeoIP2` object is a wrapper for the `MaxMind geoip2 Python
|
||||
library`__. [#]_
|
||||
|
||||
In order to perform IP-based geolocation, the :class:`GeoIP2` object requires
|
||||
the `geoip2 Python library`__ and the GeoIP ``Country`` and/or ``City``
|
||||
the :pypi:`geoip2` Python package and the GeoIP ``Country`` and/or ``City``
|
||||
datasets in binary format (the CSV files will not work!), downloaded from e.g.
|
||||
`MaxMind`__ or `DB-IP`__ websites. Grab the ``GeoLite2-Country.mmdb.gz`` and
|
||||
``GeoLite2-City.mmdb.gz`` files and unzip them in a directory corresponding to
|
||||
@ -19,7 +19,6 @@ Additionally, it is recommended to install the `libmaxminddb C library`__, so
|
||||
that ``geoip2`` can leverage the C library's faster speed.
|
||||
|
||||
__ https://geoip2.readthedocs.io/
|
||||
__ https://pypi.org/project/geoip2/
|
||||
__ https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
|
||||
__ https://db-ip.com/db/lite.php
|
||||
__ https://github.com/maxmind/libmaxminddb/
|
||||
|
@ -448,12 +448,11 @@ MySQL DB API Drivers
|
||||
MySQL has a couple drivers that implement the Python Database API described in
|
||||
:pep:`249`:
|
||||
|
||||
- `mysqlclient`_ is a native driver. It's **the recommended choice**.
|
||||
- :pypi:`mysqlclient` is a native driver. It's **the recommended choice**.
|
||||
- `MySQL Connector/Python`_ is a pure Python driver from Oracle that does not
|
||||
require the MySQL client library or any Python modules outside the standard
|
||||
library.
|
||||
|
||||
.. _mysqlclient: https://pypi.org/project/mysqlclient/
|
||||
.. _MySQL Connector/Python: https://dev.mysql.com/downloads/connector/python/
|
||||
|
||||
These drivers are thread-safe and provide connection pooling.
|
||||
@ -1176,21 +1175,14 @@ Using a 3rd-party database backend
|
||||
In addition to the officially supported databases, there are backends provided
|
||||
by 3rd parties that allow you to use other databases with Django:
|
||||
|
||||
* `CockroachDB`_
|
||||
* `Firebird`_
|
||||
* `Google Cloud Spanner`_
|
||||
* `Microsoft SQL Server`_
|
||||
* `TiDB`_
|
||||
* `YugabyteDB`_
|
||||
* :pypi:`CockroachDB <django-cockroachdb>`
|
||||
* :pypi:`Firebird <django-firebird>`
|
||||
* :pypi:`Google Cloud Spanner <django-google-spanner>`
|
||||
* :pypi:`Microsoft SQL Server <mssql-django>`
|
||||
* :pypi:`TiDB <django-tidb>`
|
||||
* :pypi:`YugabyteDB <django-yugabytedb>`
|
||||
|
||||
The Django versions and ORM features supported by these unofficial backends
|
||||
vary considerably. Queries regarding the specific capabilities of these
|
||||
unofficial backends, along with any support queries, should be directed to
|
||||
the support channels provided by each 3rd party project.
|
||||
|
||||
.. _CockroachDB: https://pypi.org/project/django-cockroachdb/
|
||||
.. _Firebird: https://pypi.org/project/django-firebird/
|
||||
.. _Google Cloud Spanner: https://pypi.org/project/django-google-spanner/
|
||||
.. _Microsoft SQL Server: https://pypi.org/project/mssql-django/
|
||||
.. _TiDB: https://pypi.org/project/django-tidb/
|
||||
.. _YugabyteDB: https://pypi.org/project/django-yugabytedb/
|
||||
|
@ -881,7 +881,7 @@ needed. You don't need to restart the server for code changes to take effect.
|
||||
However, some actions like adding files don't trigger a restart, so you'll
|
||||
have to restart the server in these cases.
|
||||
|
||||
If you're using Linux or MacOS and install both `pywatchman`_ and the
|
||||
If you're using Linux or MacOS and install both :pypi:`pywatchman` and the
|
||||
`Watchman`_ service, kernel signals will be used to autoreload the server
|
||||
(rather than polling file modification timestamps each second). This offers
|
||||
better performance on large projects, reduced response time after code changes,
|
||||
@ -903,7 +903,6 @@ more robust change detection, and a reduction in power usage. Django supports
|
||||
by setting the :envvar:`DJANGO_WATCHMAN_TIMEOUT` environment variable.
|
||||
|
||||
.. _Watchman: https://facebook.github.io/watchman/
|
||||
.. _pywatchman: https://pypi.org/project/pywatchman/
|
||||
.. _watchman documentation: https://facebook.github.io/watchman/docs/config#ignore_dirs
|
||||
|
||||
When you start the server, and each time you change Python code while the
|
||||
@ -1920,9 +1919,9 @@ Under Windows, the legacy ``cmd.exe`` native console doesn't support ANSI
|
||||
escape sequences so by default there is no color output. In this case either of
|
||||
two third-party libraries are needed:
|
||||
|
||||
* Install colorama_, a Python package that translates ANSI color codes into
|
||||
Windows API calls. Django commands will detect its presence and will make use
|
||||
of its services to color output just like on Unix-based platforms.
|
||||
* Install :pypi:`colorama`, a Python package that translates ANSI color codes
|
||||
into Windows API calls. Django commands will detect its presence and will
|
||||
make use of its services to color output just like on Unix-based platforms.
|
||||
``colorama`` can be installed via pip:
|
||||
|
||||
.. code-block:: doscon
|
||||
@ -1941,7 +1940,6 @@ installation of ``ANSICON`` by setting the appropriate environmental variable,
|
||||
.. _`Windows Terminal`: https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701
|
||||
.. _`VS Code`: https://code.visualstudio.com
|
||||
.. _ANSICON: http://adoxa.altervista.org/ansicon/
|
||||
.. _colorama: https://pypi.org/project/colorama/
|
||||
|
||||
Custom colors
|
||||
~~~~~~~~~~~~~
|
||||
|
@ -698,8 +698,8 @@ escaping HTML.
|
||||
If ``value`` is ``"<b>Joel</b> <button>is</button> a <span>slug</span>"``
|
||||
the return value will be ``"Joel is a slug"``.
|
||||
|
||||
If you are looking for a more robust solution, take a look at the `bleach
|
||||
<https://pypi.org/project/bleach/>`_ Python library.
|
||||
If you are looking for a more robust solution, take a look at the
|
||||
:pypi:`bleach` Python package.
|
||||
|
||||
.. function:: html_safe()
|
||||
|
||||
|
@ -579,8 +579,7 @@ It's automatically installed along with Django.
|
||||
|
||||
Support for ``settings.TIME_ZONE = None`` is removed as the behavior isn't
|
||||
commonly used and is questionably useful. If you want to automatically detect
|
||||
the timezone based on the system timezone, you can use `tzlocal
|
||||
<https://pypi.org/project/tzlocal/>`_::
|
||||
the timezone based on the system timezone, you can use :pypi:`tzlocal`::
|
||||
|
||||
from tzlocal import get_localzone
|
||||
|
||||
|
@ -112,8 +112,8 @@ for more details or learn how to :doc:`manage static files
|
||||
Python 2.7 introduced some major changes to the ``unittest`` library,
|
||||
adding some extremely useful features. To ensure that every Django
|
||||
project can benefit from these new features, Django ships with a copy
|
||||
of unittest2_, a copy of the Python 2.7 ``unittest`` library, backported
|
||||
for Python 2.4 compatibility.
|
||||
of :pypi:`unittest2`, a copy of the Python 2.7 ``unittest`` library,
|
||||
backported for Python 2.4 compatibility.
|
||||
|
||||
To access this library, Django provides the ``django.utils.unittest``
|
||||
module alias. If you are using Python 2.7, or you have installed
|
||||
@ -132,8 +132,6 @@ wherever you would have historically used::
|
||||
If you want to continue to use the base ``unittest`` library, you can --
|
||||
you just won't get any of the nice new ``unittest2`` features.
|
||||
|
||||
.. _unittest2: https://pypi.org/project/unittest2/
|
||||
|
||||
Transaction context managers
|
||||
----------------------------
|
||||
|
||||
|
@ -599,9 +599,8 @@ Django 1.4 also includes several smaller improvements worth noting:
|
||||
for more information.
|
||||
|
||||
* The :djadmin:`makemessages` command uses a new and more accurate lexer,
|
||||
`JsLex`_, for extracting translatable strings from JavaScript files.
|
||||
|
||||
.. _JsLex: https://pypi.org/project/jslex/
|
||||
:pypi:`JsLex <jslex>`, for extracting translatable strings from JavaScript
|
||||
files.
|
||||
|
||||
* The :ttag:`trans` template tag now takes an optional ``as`` argument to
|
||||
be able to retrieve a translation string without displaying it but setting
|
||||
|
@ -257,12 +257,10 @@ Minor features
|
||||
* Added ``BCryptSHA256PasswordHasher`` to resolve the password truncation issue
|
||||
with bcrypt.
|
||||
|
||||
* `Pillow`_ is now the preferred image manipulation library to use with Django.
|
||||
`PIL`_ is pending deprecation (support to be removed in Django 1.8).
|
||||
To upgrade, you should **first** uninstall PIL, **then** install Pillow.
|
||||
|
||||
.. _`Pillow`: https://pypi.org/project/Pillow/
|
||||
.. _`PIL`: https://pypi.org/project/PIL/
|
||||
* :pypi:`Pillow` is now the preferred image manipulation library to use with
|
||||
Django. :pypi:`PIL` is pending deprecation (support to be removed in Django
|
||||
1.8). To upgrade, you should **first** uninstall PIL, **then** install
|
||||
Pillow.
|
||||
|
||||
* :class:`~django.forms.ModelForm` accepts several new ``Meta``
|
||||
options.
|
||||
|
@ -715,13 +715,11 @@ Management Commands
|
||||
|
||||
* The :djadmin:`runserver` command received several improvements:
|
||||
|
||||
* On Linux systems, if pyinotify_ is installed, the development server will
|
||||
reload immediately when a file is changed. Previously, it polled the
|
||||
* On Linux systems, if :pypi:`pyinotify` is installed, the development server
|
||||
will reload immediately when a file is changed. Previously, it polled the
|
||||
filesystem for changes every second. That caused a small delay before
|
||||
reloads and reduced battery life on laptops.
|
||||
|
||||
.. _pyinotify: https://pypi.org/project/pyinotify/
|
||||
|
||||
* In addition, the development server automatically reloads when a
|
||||
translation file is updated, i.e. after running
|
||||
:djadmin:`compilemessages`.
|
||||
@ -735,15 +733,13 @@ Management Commands
|
||||
* :djadmin:`collectstatic` command with symlink option is now supported on
|
||||
Windows NT 6 (Windows Vista and newer).
|
||||
|
||||
* Initial SQL data now works better if the sqlparse_ Python library is
|
||||
* Initial SQL data now works better if the :pypi:`sqlparse` Python library is
|
||||
installed.
|
||||
|
||||
Note that it's deprecated in favor of the
|
||||
:class:`~django.db.migrations.operations.RunSQL` operation of migrations,
|
||||
which benefits from the improved behavior.
|
||||
|
||||
.. _sqlparse: https://pypi.org/project/sqlparse/
|
||||
|
||||
Models
|
||||
~~~~~~
|
||||
|
||||
@ -1207,11 +1203,9 @@ details.
|
||||
------------------------
|
||||
|
||||
If your project handles datetimes before 1970 or after 2037 and Django raises
|
||||
a :exc:`ValueError` when encountering them, you will have to install pytz_. You
|
||||
may be affected by this problem if you use Django's time zone-related date
|
||||
formats or :mod:`django.contrib.syndication`.
|
||||
|
||||
.. _pytz: https://pypi.org/project/pytz/
|
||||
a :exc:`ValueError` when encountering them, you will have to install
|
||||
:pypi:`pytz`. You may be affected by this problem if you use Django's time
|
||||
zone-related date formats or :mod:`django.contrib.syndication`.
|
||||
|
||||
``remove()`` and ``clear()`` methods of related managers
|
||||
--------------------------------------------------------
|
||||
|
@ -64,14 +64,12 @@ upgrade instructions in older versions of the documentation.
|
||||
Security enhancements
|
||||
---------------------
|
||||
|
||||
Several features of the django-secure_ third-party library have been
|
||||
Several features of the :pypi:`django-secure` third-party library have been
|
||||
integrated into Django. :class:`django.middleware.security.SecurityMiddleware`
|
||||
provides several security enhancements to the request/response cycle. The new
|
||||
:option:`check --deploy` option allows you to check your production settings
|
||||
file for ways to increase the security of your site.
|
||||
|
||||
.. _django-secure: https://pypi.org/project/django-secure/
|
||||
|
||||
New PostgreSQL specific functionality
|
||||
-------------------------------------
|
||||
|
||||
@ -1506,9 +1504,7 @@ in your project.
|
||||
The ``django.utils.checksums`` module has been deprecated and will be removed
|
||||
in Django 1.10. The functionality it provided (validating checksum using the
|
||||
Luhn algorithm) was undocumented and not used in Django. The module has been
|
||||
moved to the `django-localflavor`_ package (version 1.1+).
|
||||
|
||||
.. _django-localflavor: https://pypi.org/project/django-localflavor/
|
||||
moved to the :pypi:`django-localflavor` package (version 1.1+).
|
||||
|
||||
``InlineAdminForm.original_content_type_id``
|
||||
--------------------------------------------
|
||||
|
@ -37,11 +37,9 @@ after a database transaction is successfully committed. This is useful for
|
||||
tasks such as sending notification emails, creating queued tasks, or
|
||||
invalidating caches.
|
||||
|
||||
This functionality from the `django-transaction-hooks`_ package has been
|
||||
This functionality from the :pypi:`django-transaction-hooks` package has been
|
||||
integrated into Django.
|
||||
|
||||
.. _django-transaction-hooks: https://pypi.org/project/django-transaction-hooks/
|
||||
|
||||
Password validation
|
||||
-------------------
|
||||
|
||||
|
@ -408,8 +408,8 @@ Miscellaneous
|
||||
suitable alternatives. Compared to the ``QUERY_TERMS`` constant, they allow
|
||||
your code to also account for any custom lookups that have been registered.
|
||||
|
||||
* Compatibility with ``py-bcrypt`` is removed as it's unmaintained. Use `bcrypt
|
||||
<https://pypi.org/project/bcrypt/>`_ instead.
|
||||
* Compatibility with ``py-bcrypt`` is removed as it's unmaintained. Use
|
||||
:pypi:`bcrypt` instead.
|
||||
|
||||
.. _deprecated-features-2.1:
|
||||
|
||||
|
@ -333,9 +333,9 @@ change shouldn't have an impact on your tests unless you've customized
|
||||
``sqlparse`` is required dependency
|
||||
-----------------------------------
|
||||
|
||||
To simplify a few parts of Django's database handling, `sqlparse 0.2.2+
|
||||
<https://pypi.org/project/sqlparse/>`_ is now a required dependency. It's
|
||||
automatically installed along with Django.
|
||||
To simplify a few parts of Django's database handling, :pypi:`sqlparse 0.2.2+
|
||||
<sqlparse>` is now a required dependency. It's automatically installed along
|
||||
with Django.
|
||||
|
||||
``cached_property`` aliases
|
||||
---------------------------
|
||||
|
@ -497,7 +497,7 @@ Django 3.0, we're removing these APIs at this time.
|
||||
Python 3.
|
||||
|
||||
* ``django.utils.six`` - Remove usage of this vendored library or switch to
|
||||
`six <https://pypi.org/project/six/>`_.
|
||||
:pypi:`six`.
|
||||
|
||||
* ``django.utils.encoding.python_2_unicode_compatible()`` - Alias of
|
||||
``six.python_2_unicode_compatible()``.
|
||||
|
@ -143,11 +143,9 @@ Functional indexes are added to models using the
|
||||
----------------------
|
||||
|
||||
The new ``django.core.cache.backends.memcached.PyMemcacheCache`` cache backend
|
||||
allows using the pymemcache_ library for memcached. ``pymemcache`` 3.4.0 or
|
||||
higher is required. For more details, see the :doc:`documentation on caching in
|
||||
Django </topics/cache>`.
|
||||
|
||||
.. _pymemcache: https://pypi.org/project/pymemcache/
|
||||
allows using the :pypi:`pymemcache` library for memcached. ``pymemcache`` 3.4.0
|
||||
or higher is required. For more details, see the :doc:`documentation on caching
|
||||
in Django </topics/cache>`.
|
||||
|
||||
New decorators for the admin site
|
||||
---------------------------------
|
||||
|
@ -5,9 +5,7 @@ Django 4.0.3 release notes
|
||||
*March 1, 2022*
|
||||
|
||||
Django 4.0.3 fixes several bugs in 4.0.2. Also, all Python code in Django is
|
||||
reformatted with `black`_.
|
||||
|
||||
.. _black: https://pypi.org/project/black/
|
||||
reformatted with :pypi:`black`.
|
||||
|
||||
Bugfixes
|
||||
========
|
||||
|
@ -109,11 +109,9 @@ Redis cache backend
|
||||
-------------------
|
||||
|
||||
The new ``django.core.cache.backends.redis.RedisCache`` cache backend provides
|
||||
built-in support for caching with Redis. `redis-py`_ 3.0.0 or higher is
|
||||
required. For more details, see the :ref:`documentation on caching with Redis
|
||||
in Django <redis>`.
|
||||
|
||||
.. _`redis-py`: https://pypi.org/project/redis/
|
||||
built-in support for caching with Redis. :pypi:`redis-py <redis>` 3.0.0 or
|
||||
higher is required. For more details, see the :ref:`documentation on caching
|
||||
with Redis in Django <redis>`.
|
||||
|
||||
Template based form rendering
|
||||
-----------------------------
|
||||
|
@ -35,7 +35,7 @@ Psycopg 3 support
|
||||
-----------------
|
||||
|
||||
Django now supports `psycopg`_ version 3.1.8 or higher. To update your code,
|
||||
install the `psycopg library`_, you don't need to change the
|
||||
install the :pypi:`psycopg library <psycopg>`, you don't need to change the
|
||||
:setting:`ENGINE <DATABASE-ENGINE>` as ``django.db.backends.postgresql``
|
||||
supports both libraries.
|
||||
|
||||
@ -47,7 +47,6 @@ As a consequence, you may need to make some changes to account for
|
||||
`differences from psycopg2`_.
|
||||
|
||||
.. _psycopg: https://www.psycopg.org/psycopg3/
|
||||
.. _psycopg library: https://pypi.org/project/psycopg/
|
||||
.. _differences from psycopg2: https://www.psycopg.org/psycopg3/docs/basic/from_pg2.html
|
||||
|
||||
Comments on columns and tables
|
||||
@ -459,8 +458,8 @@ Miscellaneous
|
||||
* The minimum supported version of ``jinja2`` is increased from 2.9.2 to
|
||||
2.11.0.
|
||||
|
||||
* The minimum supported version of `redis-py`_ is increased from 3.0.0 to
|
||||
3.4.0.
|
||||
* The minimum supported version of :pypi:`redis-py <redis>` is increased from
|
||||
3.0.0 to 3.4.0.
|
||||
|
||||
* Manually instantiated ``WSGIRequest`` objects must be provided a file-like
|
||||
object for ``wsgi.input``. Previously, Django was more lax than the expected
|
||||
@ -468,8 +467,6 @@ Miscellaneous
|
||||
|
||||
* Support for ``PROJ`` < 5 is removed.
|
||||
|
||||
.. _`redis-py`: https://pypi.org/project/redis/
|
||||
|
||||
.. _deprecated-features-4.2:
|
||||
|
||||
Features deprecated in 4.2
|
||||
|
@ -234,12 +234,10 @@ context, or vice-versa. For this there are two adapter functions, from the
|
||||
are used to transition between the calling styles while preserving
|
||||
compatibility.
|
||||
|
||||
These adapter functions are widely used in Django. The `asgiref`_ package
|
||||
These adapter functions are widely used in Django. The :pypi:`asgiref` package
|
||||
itself is part of the Django project, and it is automatically installed as a
|
||||
dependency when you install Django with ``pip``.
|
||||
|
||||
.. _asgiref: https://pypi.org/project/asgiref/
|
||||
|
||||
``async_to_sync()``
|
||||
-------------------
|
||||
|
||||
|
@ -1356,8 +1356,7 @@ implementation details see :ref:`using-the-views`.
|
||||
difference between the duration of a reset request for an existing
|
||||
email address and the duration of a reset request for a nonexistent
|
||||
email address. To reduce the overhead, you can use a 3rd party package
|
||||
that allows to send emails asynchronously, e.g. `django-mailer
|
||||
<https://pypi.org/project/django-mailer/>`_.
|
||||
that allows to send emails asynchronously, e.g. :pypi:`django-mailer`.
|
||||
|
||||
**Attributes:**
|
||||
|
||||
|
@ -94,7 +94,7 @@ use of Argon2 rather than the other algorithms supported by Django.
|
||||
|
||||
To use Argon2id as your default storage algorithm, do the following:
|
||||
|
||||
#. Install the `argon2-cffi library`_. This can be done by running
|
||||
#. Install the :pypi:`argon2-cffi` package. This can be done by running
|
||||
``python -m pip install django[argon2]``, which is equivalent to
|
||||
``python -m pip install argon2-cffi`` (along with any version requirement
|
||||
from Django's ``setup.cfg``).
|
||||
@ -125,7 +125,7 @@ use it Django supports bcrypt with minimal effort.
|
||||
|
||||
To use Bcrypt as your default storage algorithm, do the following:
|
||||
|
||||
#. Install the `bcrypt library`_. This can be done by running
|
||||
#. Install the :pypi:`bcrypt` package. This can be done by running
|
||||
``python -m pip install django[bcrypt]``, which is equivalent to
|
||||
``python -m pip install bcrypt`` (along with any version requirement from
|
||||
Django's ``setup.cfg``).
|
||||
@ -416,8 +416,6 @@ Include any other hashers that your site uses in this list.
|
||||
.. _pbkdf2: https://en.wikipedia.org/wiki/PBKDF2
|
||||
.. _nist: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf
|
||||
.. _bcrypt: https://en.wikipedia.org/wiki/Bcrypt
|
||||
.. _`bcrypt library`: https://pypi.org/project/bcrypt/
|
||||
.. _`argon2-cffi library`: https://pypi.org/project/argon2-cffi/
|
||||
.. _argon2: https://en.wikipedia.org/wiki/Argon2
|
||||
.. _scrypt: https://en.wikipedia.org/wiki/Scrypt
|
||||
.. _`Password Hashing Competition`: https://www.password-hashing.net/
|
||||
|
@ -78,10 +78,7 @@ database or filesystem usage.
|
||||
|
||||
After installing Memcached itself, you'll need to install a Memcached
|
||||
binding. There are several Python Memcached bindings available; the
|
||||
two supported by Django are `pylibmc`_ and `pymemcache`_.
|
||||
|
||||
.. _`pylibmc`: https://pypi.org/project/pylibmc/
|
||||
.. _`pymemcache`: https://pypi.org/project/pymemcache/
|
||||
two supported by Django are :pypi:`pylibmc` and :pypi:`pymemcache`.
|
||||
|
||||
To use Memcached with Django:
|
||||
|
||||
@ -180,11 +177,8 @@ need a Redis server running either locally or on a remote machine.
|
||||
__ https://redis.io/
|
||||
|
||||
After setting up the Redis server, you'll need to install Python bindings for
|
||||
Redis. `redis-py`_ is the binding supported natively by Django. Installing the
|
||||
additional `hiredis-py`_ package is also recommended.
|
||||
|
||||
.. _`redis-py`: https://pypi.org/project/redis/
|
||||
.. _`hiredis-py`: https://pypi.org/project/hiredis/
|
||||
Redis. :pypi:`redis-py <redis>` is the binding supported natively by Django.
|
||||
Installing the :pypi:`hiredis-py <hiredis>` package is also recommended.
|
||||
|
||||
To use Redis as your cache backend with Django:
|
||||
|
||||
|
@ -14,7 +14,7 @@ and cultures.
|
||||
|
||||
* `GitHub <https://github.com/django/django-localflavor>`__
|
||||
* `Documentation <https://django-localflavor.readthedocs.io/>`__
|
||||
* `PyPI <https://pypi.org/project/django-localflavor/>`__
|
||||
* :pypi:`PyPI <django-localflavor>`
|
||||
|
||||
Comments
|
||||
========
|
||||
@ -26,7 +26,7 @@ product like Disqus.
|
||||
|
||||
* `GitHub <https://github.com/django/django-contrib-comments>`__
|
||||
* `Documentation <https://django-contrib-comments.readthedocs.io/>`__
|
||||
* `PyPI <https://pypi.org/project/django-contrib-comments/>`__
|
||||
* :pypi:`PyPI <django-contrib-comments>`
|
||||
|
||||
Formtools
|
||||
=========
|
||||
@ -35,4 +35,4 @@ Formtools
|
||||
|
||||
* `GitHub <https://github.com/jazzband/django-formtools/>`__
|
||||
* `Documentation <https://django-formtools.readthedocs.io/>`__
|
||||
* `PyPI <https://pypi.org/project/django-formtools/>`__
|
||||
* :pypi:`PyPI <django-formtools>`
|
||||
|
@ -415,8 +415,7 @@ Working with lazy translation objects
|
||||
The result of a ``gettext_lazy()`` call can be used wherever you would use a
|
||||
string (a :class:`str` object) in other Django code, but it may not work with
|
||||
arbitrary Python code. For example, the following won't work because the
|
||||
`requests <https://pypi.org/project/requests/>`_ library doesn't handle
|
||||
``gettext_lazy`` objects::
|
||||
:pypi:`requests` library doesn't handle ``gettext_lazy`` objects::
|
||||
|
||||
body = gettext_lazy("I \u2764 Django") # (Unicode :heart:)
|
||||
requests.post("https://example.com/send", data={"body": body})
|
||||
|
@ -857,7 +857,7 @@ important part of testing applications, so it's strongly recommended to check
|
||||
the coverage of your tests.
|
||||
|
||||
Django can be easily integrated with `coverage.py`_, a tool for measuring code
|
||||
coverage of Python programs. First, `install coverage.py`_. Next, run the
|
||||
coverage of Python programs. First, install :pypi:`coverage`. Next, run the
|
||||
following from your project folder containing ``manage.py``:
|
||||
|
||||
.. code-block:: shell
|
||||
@ -878,4 +878,3 @@ For more options like annotated HTML listings detailing missed lines, see the
|
||||
`coverage.py`_ docs.
|
||||
|
||||
.. _coverage.py: https://coverage.readthedocs.io/
|
||||
.. _install coverage.py: https://pypi.org/project/coverage/
|
||||
|
@ -1031,8 +1031,7 @@ port assigned by the operating system. The server's URL can be accessed with
|
||||
``self.live_server_url`` during the tests.
|
||||
|
||||
To demonstrate how to use ``LiveServerTestCase``, let's write a Selenium test.
|
||||
First of all, you need to install the `selenium package`_ into your Python
|
||||
path:
|
||||
First of all, you need to install the :pypi:`selenium` package:
|
||||
|
||||
.. console::
|
||||
|
||||
@ -1090,7 +1089,6 @@ example above is just a tiny fraction of what the Selenium client can do; check
|
||||
out the `full reference`_ for more details.
|
||||
|
||||
.. _Selenium: https://www.selenium.dev/
|
||||
.. _selenium package: https://pypi.org/project/selenium/
|
||||
.. _full reference: https://selenium-python.readthedocs.io/api.html
|
||||
.. _Firefox: https://www.mozilla.com/firefox/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user