{"title":"Writing your first contribution for Django","version":"5.0","locale":"it","docname":"intro/contributing","url":"/it/5.0/intro/contributing/","canonical":"https://djangodocs.dev/it/5.0/intro/contributing/","summary":"Introduzione Link to this heading # Ti interessa restituire qualcosa alla comunità? Potresti avere trovato un bug in Django che ti piacerebbe vedere corretto, o ci…","html":"<h1>Writing your first contribution for Django<a class=\"heading-anchor\" href=\"#writing-your-first-contribution-for-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"introduction\">\n<h2>Introduzione<a class=\"heading-anchor\" href=\"#introduction\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Ti interessa restituire qualcosa alla comunità? Potresti avere trovato un bug in Django che ti piacerebbe vedere corretto, o ci potrebbe essere una piccola funzionalità che vorresti fosse aggiunta.</p>\n<p>Contribuire a Django è il miglior modo per affrontare le tue preoccupazioni. All’inizio questo può scoraggiare ma si tratta di un percorso «battuto» con la documentazione, i tool e la community, che ti supporta. Ti accompagneremo nell’intero processo, in modo che tu possa apprendere con degli esempi.</p>\n<section id=\"who-s-this-tutorial-for\">\n<h3>Per chi è questo tutorial?<a class=\"heading-anchor\" href=\"#who-s-this-tutorial-for\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"admonition admonition-seealso\">\n<p class=\"admonition-title\">Vedi anche</p>\n<p>Se cerchi riferimenti sui dettagli per contribuire al codice, vedi la documentazione <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/\"><span class=\"doc\">Writing code</span></a></p>\n</aside>\n<p>For this tutorial, we expect that you have at least a basic understanding of\nhow Django works. This means you should be comfortable going through the\nexisting tutorials on <a class=\"reference internal\" href=\"/it/5.0/intro/tutorial01/\"><span class=\"doc\">writing your first Django app</span></a>.\nIn addition, you should have a good understanding of Python itself. But if you\ndon’t, <a class=\"reference external\" href=\"https://diveintopython3.net/\">Dive Into Python</a> is a fantastic (and free) online book for beginning\nPython programmers.</p>\n<p>Quelli di voi che non hanno familiarità con i sistemi di controllo di versione e con Trac troveranno che questo tutorial e i suoi link includono le informazioni necessarie per cominciare. Comunque, se prevedete di contribuire a Django regolarmente, probabilmente vorrete leggere di più riguardo questi strumenti.</p>\n<p>Nelle intenzioni, questo tutorial tenta di spiegare il più possibile, per essere di aiuto alla maggior parte dei lettori.</p>\n<aside class=\"admonition-where-to-get-help admonition\">\n<p class=\"admonition-title\">Dove trovare aiuto:</p>\n<p>If you’re having trouble going through this tutorial, please post a message\non the <a class=\"reference external\" href=\"https://forum.djangoproject.com/\">Django Forum</a>, <a class=\"reference internal\" href=\"/it/5.0/internals/mailing-lists/#django-developers-mailing-list\"><span class=\"std std-ref\">django-developers</span></a>, or drop by\n<a href=\"#id10\"><span class=\"problematic\" id=\"id11\">`#django-dev on irc.libera.chat`__</span></a> to chat with other Django users who\nmight be able to help.</p>\n</aside>\n</section>\n<section id=\"what-does-this-tutorial-cover\">\n<h3>Di che parla questo tutorial?<a class=\"heading-anchor\" href=\"#what-does-this-tutorial-cover\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>We’ll be walking you through contributing to Django for the first time.\nBy the end of this tutorial, you should have a basic understanding of both the\ntools and the processes involved. Specifically, we’ll be covering the following:</p>\n<ul class=\"simple\">\n<li><p>Installazione di Git.</p></li>\n<li><p>Scarica una copia della versione di sviluppo di Django</p></li>\n<li><p>Eseguire la suite di test di Django.</p></li>\n<li><p>Writing a test for your changes.</p></li>\n<li><p>Writing the code for your changes.</p></li>\n<li><p>Testing your changes.</p></li>\n<li><p>Mandare una pull request.</p></li>\n<li><p>Dove cercare per ulteriori informazioni.</p></li>\n</ul>\n<p>Una volta terminato il tutorial, puoi dare un’occhiata al resto della <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/\"><span class=\"doc\">Django’s documentation on contributing</span></a>. Contiene moltissime informazioni utili ed è una lettura imperdibile per chiunque voglia contribuire regolarmente a Django. Se hai delle domande, li probabilmente ci sono le risposte.</p>\n<aside class=\"admonition-python-3-required admonition\">\n<p class=\"admonition-title\">E” necessario Python 3!</p>\n<p>La versione correnti di Django non sopporta Python 2.7. Scarica Python 3 da <a class=\"reference external\" href=\"https://www.python.org/downloads/\">Python’s download page</a> oppure attraverso il packet manager del tuo sistema operativo.</p>\n</aside>\n<aside class=\"admonition-for-windows-users admonition\">\n<p class=\"admonition-title\">Per gli utenti Windows</p>\n<p>Vedi <a class=\"reference internal\" href=\"/it/5.0/howto/windows/#install-python-windows\"><span class=\"std std-ref\">Installa Python</span></a> sulla documentazione di Windows per una guida aggiuntiva.</p>\n</aside>\n</section>\n</section>\n<section id=\"code-of-conduct\">\n<h2>Codice di Condotta<a class=\"heading-anchor\" href=\"#code-of-conduct\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Come contributor, puoi aiutarci a tenere la Django community open e inclusa. Per favore leggi e segui i nostri  <a class=\"reference external\" href=\"https://www.djangoproject.com/conduct/\">Code of Conduct</a>.</p>\n</section>\n<section id=\"installing-git\">\n<h2>Installazione di Git<a class=\"heading-anchor\" href=\"#installing-git\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>For this tutorial, you’ll need Git installed to download the current\ndevelopment version of Django and to generate a branch for the changes you\nmake.</p>\n<p>Per verificare se hai installato Git, inserisci «git» nella riga di commando. Se ricevi come risposta che questo commando non può essere trovato, dovrai scaricarlo ed installarlo, vai alla «pagina del download di Git»__.</p>\n<p>Se non hai molta confidenza con Git, puoi sempre trovare informazioni riguardo ai suoi comandi (una volta installato) digitando «git help» nella riga di commando.</p>\n</section>\n<section id=\"getting-a-copy-of-django-s-development-version\">\n<h2>Ottenere una copia della versione di sviluppo di Django<a class=\"heading-anchor\" href=\"#getting-a-copy-of-django-s-development-version\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Il primo passo per contribuire a Django è ottenere una copia del codice sorgente.\nPrima, fare il fork : <a class=\"reference external\" href=\"https://github.com/django/django/fork\">fork Django on GitHub</a>. Dopo, dalla riga di commando, utilizza il comando «cd» per navigare fino alla directory dove vorrai posizionare la tua copia locale di Django.</p>\n<p>Scaricare la repository del codice sorgente Django usando il seguente comando</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>git<span class=\"w\"> </span>clone<span class=\"w\"> </span>https://github.com/YourGitHubName/django.git\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> git clone https://github.com/YourGitHubName/django.git\n</code></pre></div></div></div>\n<aside class=\"admonition-low-bandwidth-connection admonition\">\n<p class=\"admonition-title\">Connessione lenta?</p>\n<p>Puoi aggiungere l’argomento «–depth 1» a «git clone» per saltare il download della cronologia commit di Django che riduce il trasferimento di dati da ~250 MB a ~70 MB.</p>\n</aside>\n<p>Ora che hai una copia in locale di Django, puoi installarlo come installeresti qualunque altro pacchetto usando <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code>. Il modo più pratico per farlo è usando un <em>ambiente virtuale</em>, ovvero una feature all’interno di Python che ti permette di tenere separata una cartella di ogni pacchetto installato per ognuno dei tuoi progetti cosicché non interferiscano tra loro.</p>\n<p>È una buona idea mantenere tutti i tuoi ambienti virtuali in un unico posto, per esempio in <code class=\"docutils literal notranslate\"><span class=\"pre\">.virtualenvs/</span></code> all’interno della home.</p>\n<p>Crea un nuovo ambiente virtuale avviando:</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>python3<span class=\"w\"> </span>-m<span class=\"w\"> </span>venv<span class=\"w\"> </span>~/.virtualenvs/djangodev\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> py -m venv <span class=\"nv\">%HOMEPATH%</span>\\.virtualenvs\\djangodev\n</code></pre></div></div></div>\n<p>Il percorso è dove il nuovo environment verrà salvato sul tuo computer.</p>\n<p>Il passaggio finale nel settare il tuo ambiente virtuale è attivare:</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\">source</span><span class=\"w\"> </span>~/.virtualenvs/djangodev/bin/activate\n</code></pre></div>\n<p>Se il commando  <code class=\"docutils literal notranslate\"><span class=\"pre\">source</span></code>  non è disponibile, puoi invece usare un punto:</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=\"w\"> </span>~/.virtualenvs/djangodev/bin/activate\n</code></pre></div>\n<p>Devi attivare il virtual environment tutte le volte che apri una nuova finestra del terminale.</p>\n<aside class=\"admonition-for-windows-users admonition\">\n<p class=\"admonition-title\">Per gli utenti Windows</p>\n<p>Per attivare il tuo ambiente virtuale su Windows, avvia:</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> <span class=\"nv\">%HOMEPATH%</span>\\.virtualenvs\\djangodev\\Scripts\\activate.bat\n</code></pre></div>\n</aside>\n<p>Il nome dell’ambiente virtuale attualmente attivo è mostrato sulla linea di comando per aiutarti a tenere in mente quale stai usando. Tutto ciò che installi usando «pip» mentre questo nome è mostrato verrà installato in quell’ambiente virtuale, isolato da altri ambienti e dai pacchetti del sistema.</p>\n<p id=\"intro-contributing-install-local-copy\">Procedi e installa la copia precedentemente clonata di Django:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-2-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>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>-e<span class=\"w\"> </span>/path/to/your/local/clone/django/\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-2-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> py -m pip install -e \\path\\to\\your\\local\\clone\\django\\\n</code></pre></div></div></div>\n<p>The installed version of Django is now pointing at your local copy by installing\nin editable mode. You will immediately see any changes you make to it, which is\nof great help when writing your first contribution.</p>\n<section id=\"creating-projects-with-a-local-copy-of-django\">\n<h3>Creazione di progetti con una copia locale di Django<a class=\"heading-anchor\" href=\"#creating-projects-with-a-local-copy-of-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It may be helpful to test your local changes with a Django project. First you\nhave to create a new virtual environment, <a class=\"reference internal\" href=\"#intro-contributing-install-local-copy\"><span class=\"std std-ref\">install the previously cloned\nlocal copy of Django in editable mode</span></a>,\nand create a new Django project outside of your local copy of Django. You will\nimmediately see any changes you make to Django in your new project, which is\nof great help when writing your first contribution, especially if testing\nany changes to the UI.</p>\n<p>You can follow the <a class=\"reference internal\" href=\"/it/5.0/intro/tutorial01/\"><span class=\"doc\">tutorial</span></a> for help in creating a\nDjango project.</p>\n</section>\n</section>\n<section id=\"running-django-s-test-suite-for-the-first-time\">\n<h2>Eseguire la suite di test di Django per la prima volta<a class=\"heading-anchor\" href=\"#running-django-s-test-suite-for-the-first-time\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Quando contribuisci a Django, è molto importante che i cambiamenti che apporti al codice non introducano bug in altre aree di Django. Un modo di controllare che Django funzioni ancora dopo aver apportato i cambiamenti è quello di lanciare la suite di test di Django. Se tutti i test hanno successo, allora puoi essere ragionevolmente sicuro che i tuoi cambiamenti funzionino e che non hai pregiudicato la funzionalità di altre parti di Django. Se non hai mai lanciato la suite di test di Django, è una buona idea lanciarla prima per cominciare ad avere familiarità con i suoi output.</p>\n<p>Prima di lanciare la suite di test, entra nella directory <code class=\"docutils literal notranslate\"><span class=\"pre\">tests/</span></code> di Django usando il comando <code class=\"docutils literal notranslate\"><span class=\"pre\">cd</span> <span class=\"pre\">tests</span></code> ed installa le dipendenze per i test, lanciando:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-3-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>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>-r<span class=\"w\"> </span>requirements/py3.txt\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-3-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> py -m pip install -r requirements\\py3.txt\n</code></pre></div></div></div>\n<p>Se incontri un errore durante l’installazione, al tuo sistema potrebbe mancare una dipendenza per uno o più package Python. Consulta la documentazione del package per il quale si verifica l’errore o cerca nel web il messaggio di errore che ti si è presentato.</p>\n<p>Ora siamo pronti per far partire la nostra suite di test. Se stai usando GNU/Linux, macOS, o altre variazioni di Unix, esegui:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-4-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>./runtests.py\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-4-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> runtests.py \n</code></pre></div></div></div>\n<p>Adesso siedi e rilassati. L’intera suite di test di Django si compone di centinaia di test e ci vorrà qualche minuto perchè giri, dipendentemente dalla velocità del tuo computer.</p>\n<p>Mentre la suite di test di Django è in esecuzione, vedrai scorrere lettere rappresentanti lo stato di ogni test man mano che viene completato. «E» indica che un errore è stato trovato, e «F» indica che le asserzioni del test sono fallite. Entrambi i casi sono considerati come fallimenti. Nel mentre, «x» e «s» hanno indicato probabili fallimenti e test omessi. I punti indicano i test passati.</p>\n<p>Quando i test vengono saltati, questo accade a causa di librerie mancanti necessarie per eseguire il test; guarda <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/unit-tests/#running-unit-tests-dependencies\"><span class=\"std std-ref\">Running all the tests</span></a> per la lista delle dipendenze e assicurati di installare quelle relative ai test delle modifiche che stai facendo (non ne avremo bisogno in questa guida). Alcuni test sono per specifiche banche dati e verranno saltati se non state utilizzando quelle relative ad essi. SQLite è la banca dati di default. Per eseguire i test usandone una differente, guarda <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/unit-tests/#running-unit-tests-settings\"><span class=\"std std-ref\">Using another settings module</span></a>.</p>\n<p>Una volta che il test è terminato, dovresti venir salutato con un messaggio che ti informa se la suite di test ha avuto successo o ha fallito. Poichè non hai ancora fatto modifiche al codice Django, l’intera suite di test <strong>dovrebbe</strong> aver successo. Se invece fallisce o dà errore assicurati di aver seguito tutti i passaggi precedenti correttamente. Guarda <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/unit-tests/#running-unit-tests\"><span class=\"std std-ref\">Running the unit tests</span></a> per ulteriori informazioni.</p>\n<p>Considera che l’ultima versione del ramo «main» potrebbe non essere sempre stabile. Quando sviluppi basandoti su «main», puoi controllare  <a href=\"#id10\"><span class=\"problematic\" id=\"id12\">`Django's continuous integration builds`__</span></a> per determinare se i fallimenti sono relativi alla tua macchina o sono presenti nella build ufficiale di Django. Se controlli una build specifica, puoi vedere la  sezione «Configuration Matrix» che mostra i fallimenti dovuti alla versione di Python e al database utilizzato.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Nota</p>\n<p>For this tutorial and the ticket we’re working on, testing against SQLite\nis sufficient, however, it’s possible (and sometimes necessary) to\n<a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/unit-tests/#running-unit-tests-settings\"><span class=\"std std-ref\">run the tests using a different database</span></a>. When making UI changes, you will need to\n<a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/unit-tests/#running-selenium-tests\"><span class=\"std std-ref\">run the Selenium tests</span></a>.</p>\n</aside>\n</section>\n<section id=\"working-on-a-feature\">\n<h2>Lavorare su una funzionalità<a class=\"heading-anchor\" href=\"#working-on-a-feature\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Per questa guida, lavoreremo su un «ticket falso» come caso di studio. Queste sono le ipotesi:</p>\n<aside class=\"admonition-ticket-99999-allow-making-toast admonition\">\n<p class=\"admonition-title\">Ticket #99999 – Permette di fare un toast</p>\n<p>Django dovrebbe avere a disposizione una funzione «django.shortcuts.make_toast()» che ritorna «toast».</p>\n</aside>\n<p>Aggiungeremo ora questa funzionalità e i test associati.</p>\n</section>\n<section id=\"creating-a-branch\">\n<h2>Creating a branch<a class=\"heading-anchor\" href=\"#creating-a-branch\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Prima di fare qualsiasi modifica, crea una nuova branch per il ticket:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-5-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>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>-b<span class=\"w\"> </span>ticket_99999\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-5-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> git checkout -b ticket_99999\n</code></pre></div></div></div>\n<p>Puoi scegliere qualunque nome che desideri per il ramo, «ticket_99999» è un esempio. Tutte le modifiche fatte su questo ramo saranno specifiche per il ticket e non andranno a modificare la copia principale del codice che abbiamo clonato in precedenza.</p>\n</section>\n<section id=\"writing-some-tests-for-your-ticket\">\n<h2>Scrivere alcuni test per il tuo ticket<a class=\"heading-anchor\" href=\"#writing-some-tests-for-your-ticket\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In most cases, for a contribution to be accepted into Django it has to include\ntests. For bug fix contributions, this means writing a regression test to\nensure that  the bug is never reintroduced into Django later on. A regression\ntest should be written in such a way that it will fail while the bug still\nexists and pass once the bug has been fixed. For contributions containing new\nfeatures, you’ll need to include tests which ensure that the new features are\nworking correctly. They too should fail when the new feature is not present,\nand then pass once it has been implemented.</p>\n<p>A good way to do this is to write your new tests first, before making any\nchanges to the code. This style of development is called\n<a href=\"#id10\"><span class=\"problematic\" id=\"id13\">`test-driven development`__</span></a> and can be applied to both entire projects and\nsingle changes. After writing your tests, you then run them to make sure that\nthey do indeed fail (since you haven’t fixed that bug or added that feature\nyet). If your new tests don’t fail, you’ll need to fix them so that they do.\nAfter all, a regression test that passes regardless of whether a bug is present\nis not very helpful at preventing that bug from reoccurring down the road.</p>\n<p>Ora vediamo il nostro esempio.</p>\n<section id=\"writing-a-test-for-ticket-99999\">\n<h3>Scrivere un test per il ticket #99999<a class=\"heading-anchor\" href=\"#writing-a-test-for-ticket-99999\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Per risolvere questo ticket, aggiungeremo una funzione <code class=\"docutils literal notranslate\"><span class=\"pre\">make_toast()</span></code> al modulo <code class=\"docutils literal notranslate\"><span class=\"pre\">django.shortcuts</span></code>. Prima, scriveremo un test che usa la funzione e controlla che il suo output sia corretto.</p>\n<p>Naviga fino alla cartella di Django «tests/shortcuts/» e crea un nuovo file «test_make_toast.py». Aggiungi il seguente codice:</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=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.shortcuts</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">make_toast</span>\n<span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.test</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">SimpleTestCase</span>\n\n\n<span class=\"k\">class</span><span class=\"w\"> </span><span class=\"nc\">MakeToastTests</span><span class=\"p\">(</span><span class=\"n\">SimpleTestCase</span><span class=\"p\">):</span>\n    <span class=\"k\">def</span><span class=\"w\"> </span><span class=\"nf\">test_make_toast</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n        <span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">assertEqual</span><span class=\"p\">(</span><span class=\"n\">make_toast</span><span class=\"p\">(),</span> <span class=\"s2\">&quot;toast&quot;</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>Questo test controlla che «make_toast()» ritorna «toast».</p>\n<aside class=\"admonition-but-this-testing-thing-looks-kinda-hard admonition\">\n<p class=\"admonition-title\">Ma questa cosa del testing sembra una cosa difficile…</p>\n<p>Se non hai mai avuto a che fare con i test prima d’ora, potranno sembrarti un po” difficili da scrivere a prima vista. Per fortuna, fare i test è davvero un <em>grande</em> argomento nella programmazione, quindi ci sono molte informazioni:</p>\n<ul class=\"simple\">\n<li><p>Per iniziare a scrivere test per Django, un buon primo passo è leggere i documenti in <a class=\"reference internal\" href=\"/it/5.0/topics/testing/overview/\"><span class=\"doc\">Writing and running tests</span></a>.</p></li>\n<li><p>Buttati Into Python ( un libro online gratuito per i principianti sviluppatori di Python ) include alcuni ottimi progetti come <a href=\"#id10\"><span class=\"problematic\" id=\"id14\">`introduction to Unit Testing`__</span></a>.</p></li>\n<li><p>Dopo aver letto queste cose, se vuoi qualcosa di più succulento per i tuoi denti, c’è sempre la documentazione Python <a class=\"reference external\" href=\"https://docs.python.org/3/library/unittest.html#module-unittest\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">unittest</span></code></a></p></li>\n</ul>\n</aside>\n</section>\n<section id=\"running-your-new-test\">\n<h3>Eseguire il tuo nuovo test<a class=\"heading-anchor\" href=\"#running-your-new-test\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Poichè non abbiamo fatto ancora alcuna modifica a «django.shortcuts», il nostro test dovrebbe fallire. Eseguiamo tutti i test nella cartella «shortcuts» per assicurarci che è proprio ciò che sta accadendo. «cd» nella cartella di Django «tests/» ed esegui:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-6-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>./runtests.py<span class=\"w\"> </span>shortcuts\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-6-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> runtests.py shortcuts\n</code></pre></div></div></div>\n<p>If the tests ran correctly, you should see one failure corresponding to the test\nmethod we added, with this error:</p>\n<div class=\"code-block\" data-language=\"pytb\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Pytb</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=\"Pytb code\"><code><span class=\"x\">ImportError: cannot import name &#39;make_toast&#39; from &#39;django.shortcuts&#39;</span>\n</code></pre></div>\n<p>Se tutti i test vengono superati, assicurati di aggiungere il test mostrato in precedenza nella cartella e con il nome file appropriati.</p>\n</section>\n</section>\n<section id=\"writing-the-code-for-your-ticket\">\n<h2>Scrivere il codice per il tuo ticket<a class=\"heading-anchor\" href=\"#writing-the-code-for-your-ticket\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Successivamente aggiungeremo la funzione <code class=\"docutils literal notranslate\"><span class=\"pre\">make_toast()</span></code>.</p>\n<p>Vai alla cartella <code class=\"docutils literal notranslate\"><span class=\"pre\">django/</span></code> ed apri il file <code class=\"docutils literal notranslate\"><span class=\"pre\">shortcuts.py</span></code>. Alla fine, aggiungi:</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=\"k\">def</span><span class=\"w\"> </span><span class=\"nf\">make_toast</span><span class=\"p\">():</span>\n    <span class=\"k\">return</span> <span class=\"s2\">&quot;toast&quot;</span>\n</code></pre></div>\n<p>Ora dobbiamo assicurarci che il test che abbiamo scritto in precedenza venga superato, quindi possiamo vedere se il codice che abbiamo scritto funziona correttamente. Ancora una volta, posizionati nella cartella Django <code class=\"docutils literal notranslate\"><span class=\"pre\">tests/</span></code> ed esegui:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-7-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>./runtests.py<span class=\"w\"> </span>shortcuts\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-7-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> runtests.py shortcuts\n</code></pre></div></div></div>\n<p>Tutto dovrebbe funzionare. In caso contrario, assicurati di aver aggiunto la funzione al file corretto.</p>\n</section>\n<section id=\"running-django-s-test-suite-for-the-second-time\">\n<h2>Eseguire la suite di test di Django per la seconda volta<a class=\"heading-anchor\" href=\"#running-django-s-test-suite-for-the-second-time\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Once you’ve verified that your changes and test are working correctly, it’s\na good idea to run the entire Django test suite to verify that your change\nhasn’t introduced any bugs into other areas of Django. While successfully\npassing the entire test suite doesn’t guarantee your code is bug free, it does\nhelp identify many bugs and regressions that might otherwise go unnoticed.</p>\n<p>Per eseguire l’intera suite test di Django, a riga di commando esegui``cd`` nella cartella <code class=\"docutils literal notranslate\"><span class=\"pre\">tests/</span></code> di Django ed esegui:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-8-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>./runtests.py\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-8-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> runtests.py \n</code></pre></div></div></div>\n</section>\n<section id=\"writing-documentation\">\n<h2>Scrivere la Documentazione<a class=\"heading-anchor\" href=\"#writing-documentation\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>This is a new feature, so it should be documented. Open the file\n<code class=\"docutils literal notranslate\"><span class=\"pre\">docs/topics/http/shortcuts.txt</span></code> and add the following at the end of the\nfile:</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\">``make_toast()``</span>\n<span class=\"gh\">================</span>\n\n<span class=\"p\">..</span> <span class=\"ow\">function</span><span class=\"p\">::</span> make_toast()\n\n<span class=\"p\">..</span> <span class=\"ow\">versionadded</span><span class=\"p\">::</span> 2.2\n\nReturns <span class=\"s\">``&#39;toast&#39;``</span>.\n</code></pre></div>\n<p>Since this new feature will be in an upcoming release it is also added to the\nrelease notes for the next version of Django. Open the release notes for the\nlatest version in <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/releases/</span></code>, which at time of writing is <code class=\"docutils literal notranslate\"><span class=\"pre\">2.2.txt</span></code>.\nAdd a note under the «Minor Features» header:</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\">:mod:`django.shortcuts`</span>\n<span class=\"gh\">~~~~~~~~~~~~~~~~~~~~~~~</span>\n\n<span class=\"m\">*</span> The new <span class=\"na\">:func:</span><span class=\"nv\">`django.shortcuts.make_toast`</span> function returns <span class=\"s\">``&#39;toast&#39;``</span>.\n</code></pre></div>\n<p>Per avere ulteriori informazione riguardo la scrittura della documentazione, includendo una spiegazione di cosa sia versionadded, controlla <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-documentation/\"><span class=\"doc\">Writing documentation</span></a>. Quella pagina include una spiegazione di come creare una copia della documentazione in locale, in modo da poter avere un’anteprima dell’HTML che verrà generato.</p>\n</section>\n<section id=\"previewing-your-changes\">\n<h2>Visualizzare l’anteprima delle tue modifiche<a class=\"heading-anchor\" href=\"#previewing-your-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Now it’s time to review the changes made in the branch. To stage all the\nchanges ready for commit, run:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-9-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>git<span class=\"w\"> </span>add<span class=\"w\"> </span>--all\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-9-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> git add --all\n</code></pre></div></div></div>\n<p>Mostra le differenze tra la tua copia attuale di Django ( con le tue modifiche ) e la revisione di quello che avevi scaricato seguendo la guida.</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-10-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>git<span class=\"w\"> </span>diff<span class=\"w\"> </span>--cached\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-10-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> git diff --cached\n</code></pre></div></div></div>\n<p>Usa le freccettine per muoverti su e giu.</p>\n<div class=\"code-block\" data-language=\"diff\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Diff</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=\"Diff code\"><code><span class=\"gh\">diff --git a/django/shortcuts.py b/django/shortcuts.py</span>\n<span class=\"gh\">index 7ab1df0e9d..8dde9e28d9 100644</span>\n<span class=\"gd\">--- a/django/shortcuts.py</span>\n<span class=\"gi\">+++ b/django/shortcuts.py</span>\n<span class=\"gu\">@@ -156,3 +156,7 @@ def resolve_url(to, *args, **kwargs):</span>\n\n<span class=\"w\"> </span>    # Finally, fall back and assume it&#39;s a URL\n<span class=\"w\"> </span>    return to\n<span class=\"gi\">+</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+def make_toast():</span>\n<span class=\"gi\">+    return &#39;toast&#39;</span>\n<span class=\"gh\">diff --git a/docs/releases/2.2.txt b/docs/releases/2.2.txt</span>\n<span class=\"gh\">index 7d85d30c4a..81518187b3 100644</span>\n<span class=\"gd\">--- a/docs/releases/2.2.txt</span>\n<span class=\"gi\">+++ b/docs/releases/2.2.txt</span>\n<span class=\"gu\">@@ -40,6 +40,11 @@ database constraints. Constraints are added to models using the</span>\n<span class=\"w\"> </span>Minor features\n<span class=\"w\"> </span>--------------\n\n<span class=\"gi\">+:mod:`django.shortcuts`</span>\n<span class=\"gi\">+~~~~~~~~~~~~~~~~~~~~~~~</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+* The new :func:`django.shortcuts.make_toast` function returns ``&#39;toast&#39;``.</span>\n<span class=\"gi\">+</span>\n<span class=\"w\"> </span>:mod:`django.contrib.admin`\n<span class=\"w\"> </span>~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n<span class=\"gh\">diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt</span>\n<span class=\"gh\">index 7b3a3a2c00..711bf6bb6d 100644</span>\n<span class=\"gd\">--- a/docs/topics/http/shortcuts.txt</span>\n<span class=\"gi\">+++ b/docs/topics/http/shortcuts.txt</span>\n<span class=\"gu\">@@ -271,3 +271,12 @@ This example is equivalent to::</span>\n<span class=\"w\"> </span>        my_objects = list(MyModel.objects.filter(published=True))\n<span class=\"w\"> </span>        if not my_objects:\n<span class=\"w\"> </span>            raise Http404(&quot;No MyModel matches the given query.&quot;)\n<span class=\"gi\">+</span>\n<span class=\"gi\">+``make_toast()``</span>\n<span class=\"gi\">+================</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+.. function:: make_toast()</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+.. versionadded:: 2.2</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+Returns ``&#39;toast&#39;``.</span>\n<span class=\"gh\">diff --git a/tests/shortcuts/test_make_toast.py b/tests/shortcuts/test_make_toast.py</span>\nnew file mode 100644\n<span class=\"gh\">index 0000000000..6f4c627b6e</span>\n<span class=\"gd\">--- /dev/null</span>\n<span class=\"gi\">+++ b/tests/shortcuts/test_make_toast.py</span>\n<span class=\"gu\">@@ -0,0 +1,7 @@</span>\n<span class=\"gi\">+from django.shortcuts import make_toast</span>\n<span class=\"gi\">+from django.test import SimpleTestCase</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+</span>\n<span class=\"gi\">+class MakeToastTests(SimpleTestCase):</span>\n<span class=\"gi\">+    def test_make_toast(self):</span>\n<span class=\"gi\">+        self.assertEqual(make_toast(), &#39;toast&#39;)</span>\n</code></pre></div>\n<p>When you’re done previewing the changes, hit the <code class=\"docutils literal notranslate\"><span class=\"pre\">q</span></code> key to return to the\ncommand line. If the diff looked okay, it’s time to commit the changes.</p>\n</section>\n<section id=\"committing-the-changes\">\n<h2>Committing the changes<a class=\"heading-anchor\" href=\"#committing-the-changes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Per confermare le modifiche:</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-11-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>git<span class=\"w\"> </span>commit\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-11-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> git commit\n</code></pre></div></div></div>\n<p>Questo apre l’editor di test per inserire il messaggio di commit. Segui le linee guida del :ref:”messaggio di commit&lt;committing-guidelines&gt;” e scrivi un messaggio tipo:</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</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=\"Text code\"><code>Fixed #99999 -- Added a shortcut function to make toast.\n</code></pre></div>\n</section>\n<section id=\"pushing-the-commit-and-making-a-pull-request\">\n<h2>Inviare il commit e creare una pull request<a class=\"heading-anchor\" href=\"#pushing-the-commit-and-making-a-pull-request\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>After committing the changes, send it to your fork on GitHub (substitute\n«ticket_99999» with the name of your branch if it’s different):</p>\n<div class=\"console\" data-console><div class=\"console-panel\" data-platform=\"unix\"><p class=\"console-label\" id=\"console-12-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>git<span class=\"w\"> </span>push<span class=\"w\"> </span>origin<span class=\"w\"> </span>ticket_99999\n</code></pre></div>\n</div><div class=\"console-panel\" data-platform=\"windows\"><p class=\"console-label\" id=\"console-12-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> git push origin ticket_99999\n</code></pre></div></div></div>\n<p>Puoi creare una pull request vistando la <a class=\"reference external\" href=\"https://github.com/django/django/\">Django GitHub page</a>. Vedrai il tuo branch nella sezione «Your recently pushed branches». Clicca «Compare &amp; pull request» di fianco.</p>\n<p>Please don’t do it for this tutorial, but on the next page that displays a\npreview of the changes, you would click «Create pull request».</p>\n</section>\n<section id=\"next-steps\">\n<h2>Prossimi passi<a class=\"heading-anchor\" href=\"#next-steps\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Congratulazioni, hai imparato a fare una richiesta pull a Django! Dettagli su tecniche più avanzate di cui potresti aver bisogno sono in <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/working-with-git/\"><span class=\"doc\">Working with Git and GitHub</span></a>.</p>\n<p>Ora puoi utilizzare queste conoscenze aiutando a migliorare il codice di Django.</p>\n<section id=\"more-information-for-new-contributors\">\n<h3>Maggiori informazioni per nuovi contributori<a class=\"heading-anchor\" href=\"#more-information-for-new-contributors\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Before you get too into contributing to Django, there’s a little more\ninformation on contributing that you should probably take a look at:</p>\n<ul class=\"simple\">\n<li><p>You should make sure to read Django’s documentation on\n<a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/submitting-patches/\"><span class=\"doc\">claiming tickets and submitting pull requests</span></a>.\nIt covers Trac etiquette, how to claim tickets for yourself, expected\ncoding style (both for code and docs), and many other important details.</p></li>\n<li><p>Chi vuole contribuire per la prima volta dovrebbe anche leggere la :doc:”documentazione per i nuovi contributori&lt;/internals/contributing/new-contributors/&gt;” di Django. E” piena di buoni consigli per quelli di noi che sono nuovi nell’aiutare con Django.</p></li>\n<li><p>Dopo questi, se sei ancora in cerca di altre informazioni sul contribuire, puoi sempre cercare nel resto della :doc:”documentazione di Django sul contribuire&lt;/internals/contributing/index&gt;”. Contiene molte informazioni utili e dovrebbe essere la tua prima fonte di informazione per rispondere alle domande che potresti avere.</p></li>\n</ul>\n</section>\n<section id=\"finding-your-first-real-ticket\">\n<h3>Cercare il tuo primo vero ticket<a class=\"heading-anchor\" href=\"#finding-your-first-real-ticket\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Once you’ve looked through some of that information, you’ll be ready to go out\nand find a ticket of your own to contribute to. Pay special attention to\ntickets with the «easy pickings» criterion. These tickets are often much\nsimpler in nature and are great for first time contributors. Once you’re\nfamiliar with contributing to Django, you can start working on more difficult\nand complicated tickets.</p>\n<p>If you just want to get started already (and nobody would blame you!), try\ntaking a look at the list of <a href=\"#id10\"><span class=\"problematic\" id=\"id15\">`easy tickets without a branch`__</span></a> and the\n<a href=\"#id10\"><span class=\"problematic\" id=\"id16\">`easy tickets that have branches which need improvement`__</span></a>. If you’re familiar\nwith writing tests, you can also look at the list of\n<a href=\"#id10\"><span class=\"problematic\" id=\"id17\">`easy tickets that need tests`__</span></a>. Remember to follow the guidelines about\nclaiming tickets that were mentioned in the link to Django’s documentation on\n<a class=\"reference internal\" href=\"/it/5.0/internals/contributing/writing-code/submitting-patches/\"><span class=\"doc\">claiming tickets and submitting branches</span></a>.</p>\n</section>\n<section id=\"what-s-next-after-creating-a-pull-request\">\n<h3>Cosa fare dopo aver creato una pull request?<a class=\"heading-anchor\" href=\"#what-s-next-after-creating-a-pull-request\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>After a ticket has a branch, it needs to be reviewed by a second set of eyes.\nAfter submitting a pull request, update the ticket metadata by setting the\nflags on the ticket to say «has patch», «doesn’t need tests», etc, so others\ncan find it for review. Contributing doesn’t necessarily always mean writing\ncode from scratch. Reviewing open pull requests is also a very helpful\ncontribution. See <a class=\"reference internal\" href=\"/it/5.0/internals/contributing/triaging-tickets/\"><span class=\"doc\">Triaging tickets</span></a> for details.</p>\n</section>\n</section>","rootId":"writing-your-first-contribution-for-django","toc":[{"title":"Introduzione","anchor":"introduction","children":[{"title":"Per chi è questo tutorial?","anchor":"who-s-this-tutorial-for","children":[]},{"title":"Di che parla questo tutorial?","anchor":"what-does-this-tutorial-cover","children":[]}]},{"title":"Codice di Condotta","anchor":"code-of-conduct","children":[]},{"title":"Installazione di Git","anchor":"installing-git","children":[]},{"title":"Ottenere una copia della versione di sviluppo di Django","anchor":"getting-a-copy-of-django-s-development-version","children":[{"title":"Creazione di progetti con una copia locale di Django","anchor":"creating-projects-with-a-local-copy-of-django","children":[]}]},{"title":"Eseguire la suite di test di Django per la prima volta","anchor":"running-django-s-test-suite-for-the-first-time","children":[]},{"title":"Lavorare su una funzionalità","anchor":"working-on-a-feature","children":[]},{"title":"Creating a branch","anchor":"creating-a-branch","children":[]},{"title":"Scrivere alcuni test per il tuo ticket","anchor":"writing-some-tests-for-your-ticket","children":[{"title":"Scrivere un test per il ticket #99999","anchor":"writing-a-test-for-ticket-99999","children":[]},{"title":"Eseguire il tuo nuovo test","anchor":"running-your-new-test","children":[]}]},{"title":"Scrivere il codice per il tuo ticket","anchor":"writing-the-code-for-your-ticket","children":[]},{"title":"Eseguire la suite di test di Django per la seconda volta","anchor":"running-django-s-test-suite-for-the-second-time","children":[]},{"title":"Scrivere la Documentazione","anchor":"writing-documentation","children":[]},{"title":"Visualizzare l’anteprima delle tue modifiche","anchor":"previewing-your-changes","children":[]},{"title":"Committing the changes","anchor":"committing-the-changes","children":[]},{"title":"Inviare il commit e creare una pull request","anchor":"pushing-the-commit-and-making-a-pull-request","children":[]},{"title":"Prossimi passi","anchor":"next-steps","children":[{"title":"Maggiori informazioni per nuovi contributori","anchor":"more-information-for-new-contributors","children":[]},{"title":"Cercare il tuo primo vero ticket","anchor":"finding-your-first-real-ticket","children":[]},{"title":"Cosa fare dopo aver creato una pull request?","anchor":"what-s-next-after-creating-a-pull-request","children":[]}]}],"breadcrumbs":[{"docname":"intro/index","title":"Come iniziare","url":"/it/5.0/intro/"}],"prev":{"docname":"intro/whatsnext","title":"Cosa leggere dopo","url":"/it/5.0/intro/whatsnext/"},"next":{"docname":"topics/index","title":"Using Django","url":"/it/5.0/topics/"},"formats":{"html":"/it/5.0/intro/contributing/","markdown":"/it/5.0/intro/contributing.md","json":"/it/5.0/intro/contributing.json"},"source":"https://github.com/django/django/blob/stable/5.0.x/docs/intro/contributing.txt","official":"https://docs.djangoproject.com/it/5.0/intro/contributing/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2"],"inLocales":["en","zh-hans","fr","ja","id","it","pt-br","ko","es","el","pl"]}