diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-28 19:52:15 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-28 19:53:02 +0100 |
| commit | f33eddff8ad166de2677b9ee19835f97e673ab1b (patch) | |
| tree | 6bd195c23ae14004cb6cb57deec520ea80db52cc /docs | |
| parent | 454269b2e124865be49e79e0394e1485043be5f2 (diff) | |
[5.0.x] Corrected code-block directives in docs.
Backport of 0be6dde81721e4a61caf45422987c599ebfcfe56 from main
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/gis/tutorial.txt | 15 | ||||
| -rw-r--r-- | docs/ref/models/expressions.txt | 4 | ||||
| -rw-r--r-- | docs/ref/request-response.txt | 5 | ||||
| -rw-r--r-- | docs/ref/templates/builtins.txt | 7 |
4 files changed, 14 insertions, 17 deletions
diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index d1c4cdb8e4..eb62df56a8 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -252,7 +252,7 @@ model: This command should produce the following output: -.. console:: +.. code-block:: sql BEGIN; -- @@ -686,12 +686,13 @@ __ https://spatialreference.org/ref/epsg/32140/ .. code-block:: pycon - from django.db import connection - # or if you're querying a non-default database: - from django.db import connections - connection = connections['your_gis_db_alias'] - - City.objects.raw('SELECT id, name, %s as point from myapp_city' % (connection.ops.select % 'point')) + >>> from django.db import connection + >>> # or if you're querying a non-default database: + >>> from django.db import connections + >>> connection = connections["your_gis_db_alias"] + >>> City.objects.raw( + ... "SELECT id, name, %s as point from myapp_city" % (connection.ops.select % "point") + ... ) You should only use raw queries when you know exactly what you're doing. diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt index d2aeb1dcaf..63847a2328 100644 --- a/docs/ref/models/expressions.txt +++ b/docs/ref/models/expressions.txt @@ -757,9 +757,7 @@ should avoid them if possible. your SQL with user-provided data. You also must not quote placeholders in the SQL string. This example is - vulnerable to SQL injection because of the quotes around ``%s``: - - .. code-block:: pycon + vulnerable to SQL injection because of the quotes around ``%s``:: RawSQL("select col from sometable where othercol = '%s'") # unsafe! diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 3148f8ace5..49ee126aca 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -1090,13 +1090,12 @@ Custom response classes ~~~~~~~~~~~~~~~~~~~~~~~ If you find yourself needing a response class that Django doesn't provide, you -can create it with the help of :py:class:`http.HTTPStatus`. For example: - -.. code-block:: pycon +can create it with the help of :py:class:`http.HTTPStatus`. For example:: from http import HTTPStatus from django.http import HttpResponse + class HttpResponseNoContent(HttpResponse): status_code = HTTPStatus.NO_CONTENT diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 536f9259bc..c95006fb51 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -524,11 +524,10 @@ Use of both ``and`` and ``or`` clauses within the same tag is allowed, with {% if athlete_list and coach_list or cheerleader_list %} -will be interpreted like: +will be interpreted like:: -.. code-block:: pycon - - if (athlete_list and coach_list) or cheerleader_list + if (athlete_list and coach_list) or cheerleader_list: + ... Use of actual parentheses in the :ttag:`if` tag is invalid syntax. If you need them to indicate precedence, you should use nested :ttag:`if` tags. |
