1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed docs build with sphinxcontrib-spelling 7.5.0+.

sphinxcontrib-spelling 7.5.0+ includes captions of figures in the set
of nodes for which the text is checked.
This commit is contained in:
Mariusz Felisiak
2022-05-31 07:40:54 +02:00
parent 1058fc7023
commit ac90529cc5
31 changed files with 128 additions and 127 deletions

View File

@@ -343,7 +343,7 @@ modify the pattern to work with any algorithm or with a custom user model.
First, we'll add the custom hasher:
.. code-block:: python
:caption: accounts/hashers.py
:caption: ``accounts/hashers.py``
from django.contrib.auth.hashers import (
PBKDF2PasswordHasher, SHA1PasswordHasher,
@@ -363,7 +363,7 @@ First, we'll add the custom hasher:
The data migration might look something like:
.. code-block:: python
:caption: accounts/migrations/0002_migrate_sha1_passwords.py
:caption: ``accounts/migrations/0002_migrate_sha1_passwords.py``
from django.db import migrations
@@ -398,7 +398,7 @@ several thousand users, depending on the speed of your hardware.
Finally, we'll add a :setting:`PASSWORD_HASHERS` setting:
.. code-block:: python
:caption: mysite/settings.py
:caption: ``mysite/settings.py``
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',

View File

@@ -19,7 +19,7 @@ Basic forms
Given a contact form:
.. code-block:: python
:caption: forms.py
:caption: ``forms.py``
from django import forms
@@ -34,7 +34,7 @@ Given a contact form:
The view can be constructed using a ``FormView``:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from myapp.forms import ContactForm
from django.views.generic.edit import FormView
@@ -97,7 +97,7 @@ First we need to add :meth:`~django.db.models.Model.get_absolute_url()` to our
``Author`` class:
.. code-block:: python
:caption: models.py
:caption: ``models.py``
from django.db import models
from django.urls import reverse
@@ -113,7 +113,7 @@ work. Notice how we're just configuring the generic class-based views
here; we don't have to write any logic ourselves:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView, DeleteView, UpdateView
@@ -147,7 +147,7 @@ and :attr:`~django.views.generic.edit.FormMixin.form_class` attributes, an
Finally, we hook these new views into the URLconf:
.. code-block:: python
:caption: urls.py
:caption: ``urls.py``
from django.urls import path
from myapp.views import AuthorCreateView, AuthorDeleteView, AuthorUpdateView
@@ -188,7 +188,7 @@ you can use a custom :class:`~django.forms.ModelForm` to do this. First, add
the foreign key relation to the model:
.. code-block:: python
:caption: models.py
:caption: ``models.py``
from django.contrib.auth.models import User
from django.db import models
@@ -204,7 +204,7 @@ to edit, and override
:meth:`~django.views.generic.edit.ModelFormMixin.form_valid()` to add the user:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.edit import CreateView

View File

@@ -221,7 +221,7 @@ We'll demonstrate this with the ``Author`` model we used in the
:doc:`generic class-based views introduction<generic-display>`.
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.urls import reverse
@@ -253,7 +253,7 @@ look up the author we're interested in, which it does with a call to
We can hook this into our URLs easily enough:
.. code-block:: python
:caption: urls.py
:caption: ``urls.py``
from django.urls import path
from books.views import RecordInterestView

View File

@@ -1474,7 +1474,7 @@ For example, if you had ``organic.py`` and ``synthetic.py`` in the ``models``
directory:
.. code-block:: python
:caption: myapp/models/__init__.py
:caption: ``myapp/models/__init__.py``
from .organic import Person
from .synthetic import Robot

View File

@@ -227,7 +227,7 @@ We already know what we want our HTML form to look like. Our starting point for
it in Django is this:
.. code-block:: python
:caption: forms.py
:caption: ``forms.py``
from django import forms
@@ -277,7 +277,7 @@ To handle the form we need to instantiate it in the view for the URL where we
want it to be published:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.http import HttpResponseRedirect
from django.shortcuts import render
@@ -404,7 +404,7 @@ Consider a more useful form than our minimal example above, which we could use
to implement "contact me" functionality on a personal website:
.. code-block:: python
:caption: forms.py
:caption: ``forms.py``
from django import forms
@@ -453,7 +453,7 @@ values to a Python ``int`` and ``float`` respectively.
Here's how the form data could be processed in the view that handles this form:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.core.mail import send_mail
@@ -526,7 +526,7 @@ In your templates:
Then you can configure the :setting:`FORM_RENDERER` setting:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
from django.forms.renderers import TemplatesSetting

View File

@@ -22,7 +22,7 @@ Basic file uploads
Consider a form containing a :class:`~django.forms.FileField`:
.. code-block:: python
:caption: forms.py
:caption: ``forms.py``
from django import forms
@@ -46,7 +46,7 @@ Most of the time, you'll pass the file data from ``request`` into the form as
described in :ref:`binding-uploaded-files`. This would look something like:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.http import HttpResponseRedirect
from django.shortcuts import render
@@ -146,7 +146,7 @@ If you want to upload multiple files using one form field, set the ``multiple``
HTML attribute of field's widget:
.. code-block:: python
:caption: forms.py
:caption: ``forms.py``
from django import forms
@@ -158,7 +158,7 @@ Then override the ``post`` method of your
uploads:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.views.generic.edit import FormView
from .forms import FileFieldForm

View File

@@ -767,7 +767,7 @@ so that it takes the instance namespace into consideration when creating and
displaying polls.
.. code-block:: python
:caption: urls.py
:caption: ``urls.py``
from django.urls import include, path
@@ -777,7 +777,7 @@ displaying polls.
]
.. code-block:: python
:caption: polls/urls.py
:caption: ``polls/urls.py``
from django.urls import path
@@ -836,7 +836,7 @@ module, or a string reference to the module, to :func:`~django.urls.include`,
not the list of ``urlpatterns`` itself.
.. code-block:: python
:caption: polls/urls.py
:caption: ``polls/urls.py``
from django.urls import path
@@ -850,7 +850,7 @@ not the list of ``urlpatterns`` itself.
]
.. code-block:: python
:caption: urls.py
:caption: ``urls.py``
from django.urls import include, path

View File

@@ -207,7 +207,7 @@ To begin, here's a small configuration that will allow you to output all log
messages to the console:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
import os
@@ -235,7 +235,7 @@ logging system print more messages from just the :ref:`django-logger` named
logger:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
import os
@@ -272,7 +272,7 @@ You don't have to log to the console. Here's a configuration which writes all
logging from the :ref:`django-logger` named logger to a local file:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
LOGGING = {
'version': 1,
@@ -299,7 +299,7 @@ location that's writable by the user that's running the Django application.
Finally, here's an example of a fairly complex logging setup:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
LOGGING = {
'version': 1,
@@ -444,7 +444,7 @@ Here's an example that disables Django's logging configuration and then
manually configures logging:
.. code-block:: python
:caption: settings.py
:caption: ``settings.py``
LOGGING_CONFIG = None

View File

@@ -88,7 +88,7 @@ must ensure that they are configured correctly, by calling
For example, assuming the following class-based view:
.. code-block:: python
:caption: views.py
:caption: ``views.py``
from django.views.generic import TemplateView
@@ -105,7 +105,7 @@ the view, then passing a ``request`` to ``setup()``, before proceeding with
your test's code:
.. code-block:: python
:caption: tests.py
:caption: ``tests.py``
from django.test import RequestFactory, TestCase
from .views import HomeView
@@ -412,7 +412,7 @@ following structure::
Let's take a look inside a couple of those files:
.. code-block:: python
:caption: runtests.py
:caption: ``runtests.py``
#!/usr/bin/env python
import os
@@ -440,7 +440,7 @@ command-line options for controlling verbosity, passing in specific test
labels to run, etc.
.. code-block:: python
:caption: tests/test_settings.py
:caption: ``tests/test_settings.py``
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [