diff options
Diffstat (limited to 'docs/topics/http')
| -rw-r--r-- | docs/topics/http/file-uploads.txt | 16 | ||||
| -rw-r--r-- | docs/topics/http/urls.txt | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/docs/topics/http/file-uploads.txt b/docs/topics/http/file-uploads.txt index 46ebf2e52a..21a6f06853 100644 --- a/docs/topics/http/file-uploads.txt +++ b/docs/topics/http/file-uploads.txt @@ -21,8 +21,8 @@ Basic file uploads Consider a simple form containing a :class:`~django.forms.FileField`: -.. snippet:: - :filename: forms.py +.. code-block:: python + :caption: forms.py from django import forms @@ -46,8 +46,8 @@ Most of the time, you'll simply pass the file data from ``request`` into the form as described in :ref:`binding-uploaded-files`. This would look something like: -.. snippet:: - :filename: views.py +.. code-block:: python + :caption: views.py from django.http import HttpResponseRedirect from django.shortcuts import render @@ -133,8 +133,8 @@ Uploading multiple files If you want to upload multiple files using one form field, set the ``multiple`` HTML attribute of field's widget: -.. snippet:: - :filename: forms.py +.. code-block:: python + :caption: forms.py from django import forms @@ -145,8 +145,8 @@ Then override the ``post`` method of your :class:`~django.views.generic.edit.FormView` subclass to handle multiple file uploads: -.. snippet:: - :filename: views.py +.. code-block:: python + :caption: views.py from django.views.generic.edit import FormView from .forms import FileFieldForm diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt index 4ee7a4e9ba..50d63e9a88 100644 --- a/docs/topics/http/urls.txt +++ b/docs/topics/http/urls.txt @@ -761,8 +761,8 @@ and one called ``'publisher-polls'``. Assume we have enhanced that application so that it takes the instance namespace into consideration when creating and displaying polls. -.. snippet:: - :filename: urls.py +.. code-block:: python + :caption: urls.py from django.urls import include, path @@ -771,8 +771,8 @@ displaying polls. path('publisher-polls/', include('polls.urls', namespace='publisher-polls')), ] -.. snippet:: - :filename: polls/urls.py +.. code-block:: python + :caption: polls/urls.py from django.urls import path @@ -830,8 +830,8 @@ at the same level as the ``urlpatterns`` attribute. You have to pass the actual module, or a string reference to the module, to :func:`~django.urls.include`, not the list of ``urlpatterns`` itself. -.. snippet:: - :filename: polls/urls.py +.. code-block:: python + :caption: polls/urls.py from django.urls import path @@ -844,8 +844,8 @@ not the list of ``urlpatterns`` itself. ... ] -.. snippet:: - :filename: urls.py +.. code-block:: python + :caption: urls.py from django.urls import include, path |
