mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #20910 -- Replaced snippet directive with code-block.
This commit is contained in:
committed by
Tim Graham
parent
f8ff529ee3
commit
c49ea6f591
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user