mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #20910 -- Replaced snippet directive with code-block.
This commit is contained in:
parent
f8ff529ee3
commit
c49ea6f591
32 changed files with 234 additions and 375 deletions
|
@ -58,7 +58,7 @@ look like in JSON:
|
|||
|
||||
And here's that same fixture as YAML:
|
||||
|
||||
.. code-block:: none
|
||||
.. code-block:: yaml
|
||||
|
||||
- model: myapp.person
|
||||
pk: 1
|
||||
|
|
|
@ -39,8 +39,8 @@ attribute::
|
|||
You can also provide hints that will be passed to the :meth:`allow_migrate()`
|
||||
method of database routers as ``**hints``:
|
||||
|
||||
.. snippet::
|
||||
:filename: myapp/dbrouters.py
|
||||
.. code-block:: python
|
||||
:caption: myapp/dbrouters.py
|
||||
|
||||
class MyRouter:
|
||||
|
||||
|
@ -97,8 +97,8 @@ the respective field according to your needs.
|
|||
of the three new files) to the last migration, change ``AddField`` to
|
||||
``AlterField``, and add imports of ``uuid`` and ``models``. For example:
|
||||
|
||||
.. snippet::
|
||||
:filename: 0006_remove_uuid_null.py
|
||||
.. code-block:: python
|
||||
:caption: 0006_remove_uuid_null.py
|
||||
|
||||
# Generated by Django A.B on YYYY-MM-DD HH:MM
|
||||
from django.db import migrations, models
|
||||
|
@ -121,8 +121,8 @@ the respective field according to your needs.
|
|||
* Edit the first migration file. The generated migration class should look
|
||||
similar to this:
|
||||
|
||||
.. snippet::
|
||||
:filename: 0004_add_uuid_field.py
|
||||
.. code-block:: python
|
||||
:caption: 0004_add_uuid_field.py
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -148,8 +148,8 @@ the respective field according to your needs.
|
|||
unique value (UUID in the example) for each existing row. Also add an import
|
||||
of ``uuid``. For example:
|
||||
|
||||
.. snippet::
|
||||
:filename: 0005_populate_uuid_values.py
|
||||
.. code-block:: python
|
||||
:caption: 0005_populate_uuid_values.py
|
||||
|
||||
# Generated by Django A.B on YYYY-MM-DD HH:MM
|
||||
from django.db import migrations
|
||||
|
@ -279,8 +279,8 @@ project anywhere without first installing and then uninstalling the old app.
|
|||
|
||||
Here's a sample migration:
|
||||
|
||||
.. snippet::
|
||||
:filename: myapp/migrations/0124_move_old_app_to_new_app.py
|
||||
.. code-block:: python
|
||||
:caption: myapp/migrations/0124_move_old_app_to_new_app.py
|
||||
|
||||
from django.apps import apps as global_apps
|
||||
from django.db import migrations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue