{"title":"Écrire la documentation","version":"2.1","locale":"fr","docname":"internals/contributing/writing-documentation","url":"/fr/2.1/internals/contributing/writing-documentation/","canonical":"https://djangodocs.dev/fr/2.1/internals/contributing/writing-documentation/","summary":"Nous attribuons une grande importance à la cohérence et à la lisibilité de la documentation. Après tout, Django a été créé dans un environnement journalistique !…","html":"<h1>Écrire la documentation<a class=\"heading-anchor\" href=\"#writing-documentation\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Nous attribuons une grande importance à la cohérence et à la lisibilité de la documentation. Après tout, Django a été créé dans un environnement journalistique ! Nous traitons donc la documentation sur un pied d’égalité avec le code : nous visons à l’améliorer aussi souvent que possible.</p>\n<p>Les modifications de documentation se présentent généralement sous deux formes :</p>\n<ul class=\"simple\">\n<li><p>Des améliorations générales : corrections d’orthographe, résolutions d’erreurs et meilleures explications par une écriture plus claire et davantage d’exemples.</p></li>\n<li><p>Nouvelles fonctionnalités : documentation de fonctionnalités ajoutées au cadre logiciel depuis la version précédente.</p></li>\n</ul>\n<p>Cette section explique comment les rédacteurs peuvent préparer les modifications de documentation de la manière la plus utile possible et qui évite au maximum les erreurs.</p>\n<section id=\"getting-the-raw-documentation\">\n<h2>Obtention de la documentation brute<a class=\"heading-anchor\" href=\"#getting-the-raw-documentation\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Bien que la documentation de Django soit destinée à être lue au format HTML sur <a class=\"reference external\" href=\"https://docs.djangoproject.com/\">https://docs.djangoproject.com/</a>, nous l’éditons dans un ensemble de fichiers textes pour une souplesse maximale. Ces fichiers se trouvent dans le répertoire de premier niveau <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/</span></code> d’une publication de Django.</p>\n<p>Si vous souhaitez commencer à contribuer à la documentation, obtenez la version de développement de Django à partir du dépôt de code source (voir <a class=\"reference internal\" href=\"/fr/2.1/topics/install/#installing-development-version\"><span class=\"std std-ref\">Installation de la version de développement</span></a>). La version de développement possède la version la plus à jour de la documentation, comme pour le code. Nous reportons aussi les corrections et améliorations de documentation vers la dernière version publiée en fonction de ce que le commiteur décide. Ceci parce qu’il est très avantageux de posséder une documentation de la dernière version publiée la plus à jour et correcte possible (voir <a class=\"reference internal\" href=\"/fr/2.1/intro/whatsnext/#differences-between-doc-versions\"><span class=\"std std-ref\">Différences entre versions</span></a>).</p>\n</section>\n<section id=\"getting-started-with-sphinx\">\n<h2>Introduction à Sphinx<a class=\"heading-anchor\" href=\"#getting-started-with-sphinx\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>La documentation de Django utilise le système de documentation <a class=\"reference external\" href=\"http://sphinx-doc.org/\">Sphinx</a>, qui se base lui-même sur <a class=\"reference external\" href=\"http://docutils.sourceforge.net/\">docutils</a>. L’idée de base est de transformer de la documentation en texte brut avec une mise en forme minimale en HTML, PDF ou tout autre format de sortie.</p>\n<p>Pour construire la documentation localement, installez Sphinx :</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-0-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>Sphinx\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-0-windows-label\">Windows</p><div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows shell\"><code><span class=\"gp\">...\\&gt;</span> pip install Sphinx\n</code></pre></div></div></div>\n<p>Puis, à partir du répertoire <code class=\"docutils literal notranslate\"><span class=\"pre\">docs</span></code>, construisez la version HTML :</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-1-unix-label\">Linux / macOS</p><div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>make<span class=\"w\"> </span>html\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-1-windows-label\">Windows</p><div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows shell\"><code><span class=\"gp\">...\\&gt;</span> make.bat html\n</code></pre></div></div></div>\n<p>Pour commencer à contribuer, il est recommandé de lire la <a class=\"reference external\" href=\"https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html#rst-index\" title=\"(disponible dans Sphinx v9.1.1)\"><span class=\"xref std std-ref\">référence reStructuredText</span></a>.</p>\n<p>La documentation construite localement possède un thème graphique différent de celui de la documentation sur <a class=\"reference external\" href=\"https://docs.djangoproject.com\">docs.djangoproject.com</a>. Cela ne pose pas de problème. Si vos modifications apparaissent correctement sur votre machine locale, elles seront aussi correctes sur le site Web.</p>\n</section>\n<section id=\"how-the-documentation-is-organized\">\n<h2>Organisation de la documentation<a class=\"heading-anchor\" href=\"#how-the-documentation-is-organized\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>La documentation est scindée en plusieurs catégories :</p>\n<ul>\n<li><p>Les <a class=\"reference internal\" href=\"/fr/2.1/intro/\"><span class=\"doc\">tutoriels</span></a> prennent l’utilisateur par la main à travers une série d’étapes pour créer quelque chose.</p>\n<p>L’aspect important d’un tutoriel est d’aider le lecteur à accomplir quelque chose d’utile, de préférence aussi vite que possible, dans le but de lui donner confiance.</p>\n<p>Expliquez la nature du problème à résoudre afin que le lecteur comprenne ce que l’on est en train de faire. Ne pensez pas qu’il faille commencer par des explications sur le fonctionnement des choses ; ce qui compte est ce que le lecteur fait, et non pas ce que vous expliquez. Il peut être utile de faire référence à ce que l’on a fait dans des explications a posteriori.</p>\n</li>\n<li><p>Les <a class=\"reference internal\" href=\"/fr/2.1/topics/\"><span class=\"doc\">guides thématiques</span></a> visent à expliquer un concept ou un sujet d’un point de vue assez général.</p>\n<p>Faites des liens vers le matériel de référence plutôt que de le répéter. Utilisez des exemples et n’hésitez pas à expliquer des choses qui vous semblent évidentes, il pourrait s’agir de l’explication dont quelqu’un a vraiment besoin.</p>\n<p>La mise à disposition de contexte sous-jacent aide les débutants à faire des liens entre le sujet et des éléments qu’ils connaissent déjà.</p>\n</li>\n<li><p>Les <a class=\"reference internal\" href=\"/fr/2.1/ref/\"><span class=\"doc\">guides de référence</span></a> contiennent des références techniques pour les API. Ils présentent le fonctionnement de la machinerie interne de Django avec des instructions d’utilisation.</p>\n<p>Restez bien centré sur le sujet du matériel de référence. Vous pouvez compter sur la connaissance des concepts de base par le lecteur, mais celui-ci cherche à savoir ou à se rappeler comment Django les applique.</p>\n<p>Les guides de référence ne sont pas l’endroit pour des explications générales. Si vous êtes en train d’expliquer des concepts de base, il pourrait être nécessaire de déplacer ce contenu vers un guide thématique.</p>\n</li>\n<li><p>Les <a class=\"reference internal\" href=\"/fr/2.1/howto/\"><span class=\"doc\">guides pratiques</span></a> sont des marches à suivre qui accompagnent le lecteur dans une suite d’étapes dans des sujets clés.</p>\n<p>Ce qui compte le plus dans un guide pratique est le résultat attendu par son lecteur. Un guide pratique doit toujours être orienté sur le résultat plutôt que sur des détails internes sur la manière dont Django implémente ce qui est en cours d’étude.</p>\n<p>Ces guides vont plus loin que les tutoriels et comptent sur un certaine connaissance du fonctionnement de Django. On part du principe que le lecteur a suivi les tutoriels. N’hésitez pas à réorienter le lecteur sur un tutoriel adéquat plutôt que de répéter un contenu existant.</p>\n</li>\n</ul>\n</section>\n<section id=\"writing-style\">\n<h2>Style d’écriture (anglais)<a class=\"heading-anchor\" href=\"#writing-style\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Lors d’utilisation de pronoms en référence à une personne hypothétique, comme dans « a user with a session cookie », il est préférable d’utiliser des pronoms neutres. Au lieu de :</p>\n<ul class=\"simple\">\n<li><p>he ou she… utilisez they.</p></li>\n<li><p>him ou her… utilisez them.</p></li>\n<li><p>his ou her… utilisez their.</p></li>\n<li><p>his ou hers… utilisez theirs.</p></li>\n<li><p>himself ou herself… utilisez themselves.</p></li>\n</ul>\n</section>\n<section id=\"commonly-used-terms\">\n<h2>Termes fréquemment utilisés<a class=\"heading-anchor\" href=\"#commonly-used-terms\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Voici quelques lignes directrices de style pour des termes fréquemment utilisés dans la documentation :</p>\n<ul class=\"simple\">\n<li><p><strong>Django</strong> – lorsque vous vous référez au cadriciel, toujours avec un D majuscule. Il n’est en minuscules que dans le code Python et dans le logo djangoproject.com.</p></li>\n<li><p><strong>email</strong> – sans trait d’union.</p></li>\n<li><p><strong>MySQL</strong>, <strong>PostgreSQL</strong>, <strong>SQLite</strong></p></li>\n<li><p><strong>SQL</strong> – lorsqu’on se réfère à SQL, la prononciation attendue est « èsquiouèl » et non pas « sicouèl ». Ainsi, dans une phrase comme « Returns an SQL expression », « SQL » doit être précédé d’un « an » et non pas de « a ».</p></li>\n<li><p><strong>Python</strong> – mettre une majuscule quand c’est une référence au langage.</p></li>\n<li><p><strong>realize</strong>, <strong>customize</strong>, <strong>initialize</strong>, etc. – utiliser le suffixe américain « ize » et non « ise ».</p></li>\n<li><p><strong>subclass</strong> – en un mot sans trait d’union, que ce soit pour un verbe (« subclass that model ») ou un nom (« create a subclass »).</p></li>\n<li><p><strong>Web</strong>, <strong>World Wide Web</strong>, <strong>the Web</strong> – notez que Web commence toujours par une majuscule lorsqu’on fait référence au World Wide Web.</p></li>\n<li><p><strong>website</strong> – en un seul mot, sans majuscule.</p></li>\n</ul>\n</section>\n<section id=\"django-specific-terminology\">\n<h2>Terminologie spécifique à Django<a class=\"heading-anchor\" href=\"#django-specific-terminology\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p><strong>model</strong> – sans majuscule.</p></li>\n<li><p><strong>template</strong> – sans majuscule.</p></li>\n<li><p><strong>URLconf</strong> – trois premières lettres en majuscules, sans espace avant « conf ».</p></li>\n<li><p><strong>view</strong> – sans majuscule.</p></li>\n</ul>\n</section>\n<section id=\"guidelines-for-restructuredtext-files\">\n<h2>Directives pour les fichiers reStructuredText<a class=\"heading-anchor\" href=\"#guidelines-for-restructuredtext-files\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>These guidelines regulate the format of our reST (reStructuredText)\ndocumentation:</p>\n<ul>\n<li><p>In section titles, capitalize only initial words and proper nouns.</p></li>\n<li><p>Wrap the documentation at 80 characters wide, unless a code example\nis significantly less readable when split over two lines, or for another\ngood reason.</p></li>\n<li><p>The main thing to keep in mind as you write and edit docs is that the\nmore semantic markup you can add the better. So:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>Add ``django.contrib.auth`` to your ``INSTALLED_APPS``...\n</code></pre></div>\n<p>Isn’t nearly as helpful as:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>Add :mod:`django.contrib.auth` to your :setting:`INSTALLED_APPS`...\n</code></pre></div>\n<p>This is because Sphinx will generate proper links for the latter, which\ngreatly helps readers.</p>\n<p>You can prefix the target with a <code class=\"docutils literal notranslate\"><span class=\"pre\">~</span></code> (that’s a tilde) to get just the\n« last bit » of that path. So <code class=\"docutils literal notranslate\"><span class=\"pre\">:mod:`~django.contrib.auth`</span></code> will just\ndisplay a link with the title « auth ».</p>\n</li>\n<li><p>Use <a class=\"reference external\" href=\"https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#module-sphinx.ext.intersphinx\" title=\"(disponible dans Sphinx v9.1.1)\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">intersphinx</span></code></a> to reference Python’s and Sphinx”\ndocumentation.</p></li>\n<li><p>Add <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">code-block::</span> <span class=\"pre\">&lt;lang&gt;</span></code> to literal blocks so that they get\nhighlighted. Prefer relying on automatic highlighting simply using <code class=\"docutils literal notranslate\"><span class=\"pre\">::</span></code>\n(two colons). This has the benefit that if the code contains some invalid\nsyntax, it won’t be highlighted. Adding <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">code-block::</span> <span class=\"pre\">python</span></code>, for\nexample, will force highlighting despite invalid syntax.</p></li>\n<li><p>Use these heading styles:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">===</span>\n<span class=\"n\">One</span>\n<span class=\"o\">===</span>\n\n<span class=\"n\">Two</span>\n<span class=\"o\">===</span>\n\n<span class=\"n\">Three</span>\n<span class=\"o\">-----</span>\n\n<span class=\"n\">Four</span>\n<span class=\"o\">~~~~</span>\n\n<span class=\"n\">Five</span>\n<span class=\"o\">^^^^</span>\n</code></pre></div>\n</li>\n</ul>\n</section>\n<section id=\"django-specific-markup\">\n<h2>Django-specific markup<a class=\"heading-anchor\" href=\"#django-specific-markup\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Besides <a class=\"reference external\" href=\"https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html#rst-index\" title=\"(disponible dans Sphinx v9.1.1)\"><span class=\"xref std std-ref\">Sphinx’s built-in markup</span></a>, Django’s docs\ndefine some extra description units:</p>\n<ul>\n<li><p>Settings:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">setting</span><span class=\"p\">::</span> <span class=\"n\">INSTALLED_APPS</span>\n</code></pre></div>\n<p>To link to a setting, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:setting:`INSTALLED_APPS`</span></code>.</p>\n</li>\n<li><p>Template tags:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">templatetag</span><span class=\"p\">::</span> <span class=\"n\">regroup</span>\n</code></pre></div>\n<p>To link, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:ttag:`regroup`</span></code>.</p>\n</li>\n<li><p>Template filters:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">templatefilter</span><span class=\"p\">::</span> <span class=\"n\">linebreaksbr</span>\n</code></pre></div>\n<p>To link, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:tfilter:`linebreaksbr`</span></code>.</p>\n</li>\n<li><p>Field lookups (i.e. <code class=\"docutils literal notranslate\"><span class=\"pre\">Foo.objects.filter(bar__exact=whatever)</span></code>):</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">fieldlookup</span><span class=\"p\">::</span> <span class=\"n\">exact</span>\n</code></pre></div>\n<p>To link, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:lookup:`exact`</span></code>.</p>\n</li>\n<li><p>Commandes <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">django</span><span class=\"o\">-</span><span class=\"n\">admin</span><span class=\"p\">::</span> <span class=\"n\">migrate</span>\n</code></pre></div>\n<p>To link, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:djadmin:`migrate`</span></code>.</p>\n</li>\n<li><p>Options de ligne de commande <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">django</span><span class=\"o\">-</span><span class=\"n\">admin</span><span class=\"o\">-</span><span class=\"n\">option</span><span class=\"p\">::</span> <span class=\"o\">--</span><span class=\"n\">traceback</span>\n</code></pre></div>\n<p>To link, use <code class=\"docutils literal notranslate\"><span class=\"pre\">:option:`command_name</span> <span class=\"pre\">--traceback`</span></code> (or omit <code class=\"docutils literal notranslate\"><span class=\"pre\">command_name</span></code>\nfor the options shared by all commands like <code class=\"docutils literal notranslate\"><span class=\"pre\">--verbosity</span></code>).</p>\n</li>\n<li><p>Links to Trac tickets (typically reserved for patch release notes):</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>:ticket:`12345`\n</code></pre></div>\n</li>\n</ul>\n<p>Django’s documentation uses a custom <code class=\"docutils literal notranslate\"><span class=\"pre\">console</span></code> directive for documenting\ncommand-line examples involving <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin.py</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">manage.py</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span></code>,\netc.). In the HTML documentation, it renders a two-tab UI, with one tab showing\na Unix-style command prompt and a second tab showing a Windows prompt.</p>\n<p>For example, you can replace this fragment:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>use this command:\n\n.. code-block:: console\n\n    $ python manage.py shell\n</code></pre></div>\n<p>with this one:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>use this command:\n\n.. console::\n\n    $ python manage.py shell\n</code></pre></div>\n<p>Notice two things:</p>\n<ul class=\"simple\">\n<li><p>You usually will replace occurrences of the <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">code-block::</span> <span class=\"pre\">console</span></code>\ndirective.</p></li>\n<li><p>You don’t need to change the actual content of the code example. You still\nwrite it assuming a Unix-y environment (i.e. a <code class=\"docutils literal notranslate\"><span class=\"pre\">'$'</span></code> prompt symbol,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">'/'</span></code> as filesystem path components separator, etc.)</p></li>\n</ul>\n<p>The example above will render a code example block with two tabs. The first\none will show:</p>\n<div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span>python<span class=\"w\"> </span>manage.py<span class=\"w\"> </span>shell\n</code></pre></div>\n<p>(No changes from what <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">code-block::</span> <span class=\"pre\">console</span></code> would have rendered).</p>\n<p>The second one will show:</p>\n<div class=\"code-block\" data-language=\"doscon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Windows</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Windows code\"><code><span class=\"gp\">...\\&gt;</span> py manage.py shell\n</code></pre></div>\n</section>\n<section id=\"documenting-new-features\">\n<span id=\"id3\"></span><h2>Documenting new features<a class=\"heading-anchor\" href=\"#documenting-new-features\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Our policy for new features is:</p>\n<blockquote>\n<div><p>All documentation of new features should be written in a way that\nclearly designates the features are only available in the Django\ndevelopment version. Assume documentation readers are using the latest\nrelease, not the development version.</p>\n</div></blockquote>\n<p>Our preferred way for marking new features is by prefacing the features”\ndocumentation with: « <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">versionadded::</span> <span class=\"pre\">X.Y</span></code> », followed by a mandatory\nblank line and an optional description (indented).</p>\n<p>General improvements, or other changes to the APIs that should be emphasized\nshould use the « <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">versionchanged::</span> <span class=\"pre\">X.Y</span></code> » directive (with the same format\nas the <code class=\"docutils literal notranslate\"><span class=\"pre\">versionadded</span></code> mentioned above.</p>\n<p>These <code class=\"docutils literal notranslate\"><span class=\"pre\">versionadded</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">versionchanged</span></code> blocks should be « self-contained. »\nIn other words, since we only keep these annotations around for two releases,\nit’s nice to be able to remove the annotation and its contents without having\nto reflow, reindent, or edit the surrounding text. For example, instead of\nputting the entire description of a new or changed feature in a block, do\nsomething like this:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>.. class:: Author(first_name, last_name, middle_name=None)\n\n    A person who writes books.\n\n    ``first_name`` is ...\n\n    ...\n\n    ``middle_name`` is ...\n\n    .. versionchanged:: A.B\n\n        The ``middle_name`` argument was added.\n</code></pre></div>\n<p>Put the changed annotation notes at the bottom of a section, not the top.</p>\n<p>Also, avoid referring to a specific version of Django outside a\n<code class=\"docutils literal notranslate\"><span class=\"pre\">versionadded</span></code> or <code class=\"docutils literal notranslate\"><span class=\"pre\">versionchanged</span></code> block. Even inside a block, it’s often\nredundant to do so as these annotations render as « New in Django A.B: » and\n« Changed in Django A.B », respectively.</p>\n<p>If a function, attribute, etc. is added, it’s also okay to use a\n<code class=\"docutils literal notranslate\"><span class=\"pre\">versionadded</span></code> annotation like this:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"o\">..</span> <span class=\"n\">attribute</span><span class=\"p\">::</span> <span class=\"n\">Author</span><span class=\"o\">.</span><span class=\"n\">middle_name</span>\n\n    <span class=\"o\">..</span> <span class=\"n\">versionadded</span><span class=\"p\">::</span> <span class=\"n\">A</span><span class=\"o\">.</span><span class=\"n\">B</span>\n\n    <span class=\"n\">An</span> <span class=\"n\">author</span><span class=\"s1\">&#39;s middle name.</span>\n</code></pre></div>\n<p>We can simply remove the <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">versionadded::</span> <span class=\"pre\">A.B</span></code> annotation without any\nindentation changes when the time comes.</p>\n</section>\n<section id=\"minimizing-images\">\n<h2>Minimiser les images<a class=\"heading-anchor\" href=\"#minimizing-images\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Optimisez la taille de compression des images quand c’est possible, pour les fichiers PBG, utilisez OptiPNG et <code class=\"docutils literal notranslate\"><span class=\"pre\">advpng</span></code> de AdvanceCOMP :</p>\n<div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code><span class=\"gp\">$ </span><span class=\"nb\">cd</span><span class=\"w\"> </span>docs\n<span class=\"gp\">$ </span>optipng<span class=\"w\"> </span>-o7<span class=\"w\"> </span>-zm1-9<span class=\"w\"> </span>-i0<span class=\"w\"> </span>-strip<span class=\"w\"> </span>all<span class=\"w\"> </span><span class=\"sb\">`</span>find<span class=\"w\"> </span>.<span class=\"w\"> </span>-type<span class=\"w\"> </span>f<span class=\"w\"> </span>-not<span class=\"w\"> </span>-path<span class=\"w\"> </span><span class=\"s2\">&quot;./_build/*&quot;</span><span class=\"w\"> </span>-name<span class=\"w\"> </span><span class=\"s2\">&quot;*.png&quot;</span><span class=\"sb\">`</span>\n<span class=\"gp\">$ </span>advpng<span class=\"w\"> </span>-z4<span class=\"w\"> </span><span class=\"sb\">`</span>find<span class=\"w\"> </span>.<span class=\"w\"> </span>-type<span class=\"w\"> </span>f<span class=\"w\"> </span>-not<span class=\"w\"> </span>-path<span class=\"w\"> </span><span class=\"s2\">&quot;./_build/*&quot;</span><span class=\"w\"> </span>-name<span class=\"w\"> </span><span class=\"s2\">&quot;*.png&quot;</span><span class=\"sb\">`</span>\n</code></pre></div>\n<p>Cet exemple est basé sur la version 0.7.5 de OptiPNG. Les versions plus anciennes peuvent se plaindre que l’option <code class=\"docutils literal notranslate\"><span class=\"pre\">--strip</span> <span class=\"pre\">all</span></code> perd des données.</p>\n</section>\n<section id=\"an-example\">\n<h2>Un exemple<a class=\"heading-anchor\" href=\"#an-example\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Pour un exemple rapide sur la manière dont tout s’enchaîne, considérez l’exemple hypothétique suivant :</p>\n<ul>\n<li><p>Tout d’abord, la disposition générale du document <code class=\"docutils literal notranslate\"><span class=\"pre\">ref/settings.txt</span></code> pourrait ressembler à ceci :</p>\n<div class=\"code-block\" data-language=\"rst\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Rst</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Rst code\"><code><span class=\"gh\">========</span>\n<span class=\"gh\">Settings</span>\n<span class=\"gh\">========</span>\n\n<span class=\"c\">...</span>\n\n<span class=\"p\">..</span> <span class=\"nt\">_available-settings:</span>\n\n<span class=\"gh\">Available settings</span>\n<span class=\"gh\">==================</span>\n\n<span class=\"c\">...</span>\n\n<span class=\"p\">..</span> <span class=\"nt\">_deprecated-settings:</span>\n\n<span class=\"gh\">Deprecated settings</span>\n<span class=\"gh\">===================</span>\n\n<span class=\"c\">...</span>\n</code></pre></div>\n</li>\n<li><p>Ensuite, le document <code class=\"docutils literal notranslate\"><span class=\"pre\">topics/settings.txt</span></code> pourrait contenir quelque chose comme :</p>\n<div class=\"code-block\" data-language=\"rst\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Rst</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Rst code\"><code>You can access a :ref:`listing of all available settings\n<span class=\"nt\">&lt;available-settings&gt;</span>`. For a list of deprecated settings see\n<span class=\"na\">:ref:</span><span class=\"nv\">`deprecated-settings`</span>.\n\nYou can find both in the :doc:`settings reference document\n<span class=\"nt\">&lt;/ref/settings&gt;</span>`.\n</code></pre></div>\n<p>We use the Sphinx <a class=\"reference external\" href=\"https://www.sphinx-doc.org/en/master/usage/referencing.html#role-doc\" title=\"(disponible dans Sphinx v9.1.1)\"><code class=\"xref rst rst-role docutils literal notranslate\"><span class=\"pre\">doc</span></code></a> cross reference element when we want to\nlink to another document as a whole and the <a class=\"reference external\" href=\"https://www.sphinx-doc.org/en/master/usage/referencing.html#role-ref\" title=\"(disponible dans Sphinx v9.1.1)\"><code class=\"xref rst rst-role docutils literal notranslate\"><span class=\"pre\">ref</span></code></a> element when\nwe want to link to an arbitrary location in a document.</p>\n</li>\n<li><p>Next, notice how the settings are annotated:</p>\n<div class=\"code-block\" data-language=\"rst\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Rst</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Rst code\"><code><span class=\"p\">..</span> <span class=\"ow\">setting</span><span class=\"p\">::</span> ADMINS\n\n<span class=\"gh\">ADMINS</span>\n<span class=\"gh\">======</span>\n\nDefault: <span class=\"s\">``[]``</span> (Empty list)\n\nA list of all the people who get code error notifications. When\n<span class=\"s\">``DEBUG=False``</span> and a view raises an exception, Django will email these people\nwith the full exception information. Each member of the list should be a tuple\nof (Full name, email address). Example<span class=\"se\">::</span>\n\n<span class=\"s\">    [(&#39;John&#39;, &#39;john@example.com&#39;), (&#39;Mary&#39;, &#39;mary@example.com&#39;)]</span>\n\nNote that Django will email <span class=\"ge\">*all*</span> of these people whenever an error happens.\nSee <span class=\"na\">:doc:</span><span class=\"nv\">`/howto/error-reporting`</span> for more information.\n</code></pre></div>\n<p>This marks up the following header as the « canonical » target for the\nsetting <code class=\"docutils literal notranslate\"><span class=\"pre\">ADMINS</span></code>. This means any time I talk about <code class=\"docutils literal notranslate\"><span class=\"pre\">ADMINS</span></code>,\nI can reference it using <code class=\"docutils literal notranslate\"><span class=\"pre\">:setting:`ADMINS`</span></code>.</p>\n</li>\n</ul>\n<p>C’est grosso modo ainsi que le tout fonctionne.</p>\n</section>\n<section id=\"spelling-check\">\n<span id=\"documentation-spelling-check\"></span><h2>Correction orthographique<a class=\"heading-anchor\" href=\"#spelling-check\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Avant de valider votre documentation, il est recommandé de lancer le correcteur orthographique. Il est nécessaire d’installer quelques paquets au préalable :</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference external\" href=\"https://pypi.org/project/pyenchant/\">pyenchant</a> (qui nécessite <a class=\"reference external\" href=\"https://www.abisource.com/projects/enchant/\">enchant</a>)</p></li>\n<li><p><a class=\"reference external\" href=\"https://pypi.org/project/sphinxcontrib-spelling/\">sphinxcontrib-spelling</a></p></li>\n</ul>\n<p>Puis, à partir du répertoire <code class=\"docutils literal notranslate\"><span class=\"pre\">docs</span></code>, lancez <code class=\"docutils literal notranslate\"><span class=\"pre\">make</span> <span class=\"pre\">spelling</span></code>. Le cas échéant, les mots faux ainsi que le fichier et le numéro de ligne où ils apparaissent seront enregistrés dans <code class=\"docutils literal notranslate\"><span class=\"pre\">_build/spelling/output.txt</span></code>.</p>\n<p>Si vous rencontrez des faux positifs (des erreurs signalées qui n’en sont pas), faites l’une des choses suivantes :</p>\n<ul class=\"simple\">\n<li><p>Entourez le code imbriqué ou les noms de marques ou de technologie avec des accents graves(`).</p></li>\n<li><p>Cherchez des synonymes que le correcteur orthographique connaît.</p></li>\n<li><p>Si vous êtes certain-e que le mot utilisé est correct, ajoutez-le à la liste <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/spelling_wordlist</span></code> (en prenant soin de respecter l’ordre alphabétique).</p></li>\n</ul>\n</section>\n<section id=\"translating-documentation\">\n<h2>Traduction de la documentation<a class=\"heading-anchor\" href=\"#translating-documentation\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Consultez <a class=\"reference internal\" href=\"/fr/2.1/internals/contributing/localizing/#translating-documentation\"><span class=\"std std-ref\">Traduction de la documentation de Django</span></a> si vous souhaitez aider à traduire la documentation dans une autre langue.</p>\n</section>\n<section id=\"django-admin-man-page\">\n<span id=\"django-admin-manpage\"></span><h2>Page de manuel <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code><a class=\"heading-anchor\" href=\"#django-admin-man-page\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Sphinx peut générer une page de manuel pour la commande <a class=\"reference internal\" href=\"/fr/2.1/ref/django-admin/\"><span class=\"doc\">django-admin</span></a>. Ceci est configuré dans <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/conf.py</span></code>. Au contraire d’autres productions de documentation, cette page de manuel devrait être contenue dans le dépôt de Django et dans ses publications comme <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/man/django-admin.1</span></code>. Il n’est pas nécessaire de mettre à jour ce fichier lors de la mise à jour de la documentation, car sa mise est jour fait partie du processus de publication.</p>\n<p>Pour générer une version à jour de la page de manuel, lancez <code class=\"docutils literal notranslate\"><span class=\"pre\">make</span> <span class=\"pre\">man</span></code> dans le répertoire <code class=\"docutils literal notranslate\"><span class=\"pre\">docs</span></code>. La nouvelle page de manuel sera écrite dans <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/_build/man/django-admin.1</span></code>.</p>\n</section>","rootId":"writing-documentation","toc":[{"title":"Obtention de la documentation brute","anchor":"getting-the-raw-documentation","children":[]},{"title":"Introduction à Sphinx","anchor":"getting-started-with-sphinx","children":[]},{"title":"Organisation de la documentation","anchor":"how-the-documentation-is-organized","children":[]},{"title":"Style d’écriture (anglais)","anchor":"writing-style","children":[]},{"title":"Termes fréquemment utilisés","anchor":"commonly-used-terms","children":[]},{"title":"Terminologie spécifique à Django","anchor":"django-specific-terminology","children":[]},{"title":"Directives pour les fichiers reStructuredText","anchor":"guidelines-for-restructuredtext-files","children":[]},{"title":"Django-specific markup","anchor":"django-specific-markup","children":[]},{"title":"Documenting new features","anchor":"documenting-new-features","children":[]},{"title":"Minimiser les images","anchor":"minimizing-images","children":[]},{"title":"Un exemple","anchor":"an-example","children":[]},{"title":"Correction orthographique","anchor":"spelling-check","children":[]},{"title":"Traduction de la documentation","anchor":"translating-documentation","children":[]},{"title":"Page de manuel django-admin","anchor":"django-admin-man-page","children":[]}],"breadcrumbs":[{"docname":"internals/index","title":"Fonctionnement interne du projet Django","url":"/fr/2.1/internals/"},{"docname":"internals/contributing/index","title":"Contribuer à Django","url":"/fr/2.1/internals/contributing/"}],"prev":{"docname":"internals/contributing/writing-code/javascript","title":"JavaScript","url":"/fr/2.1/internals/contributing/writing-code/javascript/"},"next":{"docname":"internals/contributing/localizing","title":"Traduction de Django","url":"/fr/2.1/internals/contributing/localizing/"},"formats":{"html":"/fr/2.1/internals/contributing/writing-documentation/","markdown":"/fr/2.1/internals/contributing/writing-documentation.md","json":"/fr/2.1/internals/contributing/writing-documentation.json"},"source":"https://github.com/django/django/blob/stable/2.1.x/docs/internals/contributing/writing-documentation.txt","official":"https://docs.djangoproject.com/fr/2.1/internals/contributing/writing-documentation/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","zh-hans","fr","ja","id","pt-br","ko","es","el","pl"]}