diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2023-02-09 16:48:46 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-10 21:12:06 +0100 |
| commit | b784768eef75afb32f6d2ce7166551a528bce0ec (patch) | |
| tree | a375a57a50f1766538ea8a62ec49bda352d7f2b9 /docs/faq | |
| parent | 4a89aa25c91e520c247aee428782274dcf10ffd0 (diff) | |
[4.2.x] Refs #34140 -- Applied rst code-block to non-Python examples.
Thanks to J.V. Zammit, Paolo Melchiorre, and Mariusz Felisiak for
reviews.
Backport of 534ac4829764f317cf2fbc4a18354fcc998c1425 from main.
Diffstat (limited to 'docs/faq')
| -rw-r--r-- | docs/faq/general.txt | 4 | ||||
| -rw-r--r-- | docs/faq/models.txt | 18 | ||||
| -rw-r--r-- | docs/faq/troubleshooting.txt | 4 |
3 files changed, 18 insertions, 8 deletions
diff --git a/docs/faq/general.txt b/docs/faq/general.txt index 1be9dc0cf4..41be777b3b 100644 --- a/docs/faq/general.txt +++ b/docs/faq/general.txt @@ -195,7 +195,9 @@ It's difficult to give an official citation format, for two reasons: citation formats can vary wildly between publications, and citation standards for software are still a matter of some debate. -For example, `APA style`_, would dictate something like:: +For example, `APA style`_, would dictate something like: + +.. code-block:: text Django (Version 1.5) [Computer Software]. (2013). Retrieved from https://www.djangoproject.com/. diff --git a/docs/faq/models.txt b/docs/faq/models.txt index 42c9604d53..3cb1c6166b 100644 --- a/docs/faq/models.txt +++ b/docs/faq/models.txt @@ -8,7 +8,9 @@ How can I see the raw SQL queries Django is running? ==================================================== Make sure your Django :setting:`DEBUG` setting is set to ``True``. -Then do this:: +Then do this: + +.. code-block:: pycon >>> from django.db import connection >>> connection.queries @@ -17,16 +19,18 @@ Then do this:: ``connection.queries`` is only available if :setting:`DEBUG` is ``True``. It's a list of dictionaries in order of query execution. Each dictionary has -the following:: +the following: - ``sql`` -- The raw SQL statement - ``time`` -- How long the statement took to execute, in seconds. +* ``sql`` - The raw SQL statement +* ``time`` - How long the statement took to execute, in seconds. ``connection.queries`` includes all SQL statements -- INSERTs, UPDATES, SELECTs, etc. Each time your app hits the database, the query will be recorded. If you are using :doc:`multiple databases</topics/db/multi-db>`, you can use the -same interface on each member of the ``connections`` dictionary:: +same interface on each member of the ``connections`` dictionary: + +.. code-block:: pycon >>> from django.db import connections >>> connections['my_db_alias'].queries @@ -85,6 +89,8 @@ these options, create a migration with a ``ALTER TABLE`` statements that do what you want to do. For example, if you're using MySQL and want your tables to use the MyISAM table -type, use the following SQL:: +type, use the following SQL: + +.. code-block:: sql ALTER TABLE myapp_mytable ENGINE=MyISAM; diff --git a/docs/faq/troubleshooting.txt b/docs/faq/troubleshooting.txt index ce468a56a6..21b1a70ba5 100644 --- a/docs/faq/troubleshooting.txt +++ b/docs/faq/troubleshooting.txt @@ -36,7 +36,9 @@ I'm getting a ``UnicodeDecodeError``. What am I doing wrong? This class of errors happen when a bytestring containing non-ASCII sequences is transformed into a Unicode string and the specified encoding is incorrect. The -output generally looks like this:: +output generally looks like this: + +.. code-block:: pytb UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position ?: ordinal not in range(128) |
