# Documentation Django 3.1.9.dev

# Soumission de correctifs

Nous sommes toujours reconnaissants pour tout correctif au code de Django. Il est vrai que les rapports de bogue avec correctif associé seront résolus bien plus rapidement que ceux sans correctif.

## Corrections orthographiques et modifications de documentation

Si vous corrigez un problème vraiment trivial, par exemple en changeant un mot dans la documentation, la manière préférée de soumettre un correctif est de passer par les requêtes de contribution GitHub sans ouvrir un ticket Trac.

Consultez Travailler avec Git et GitHub pour plus de détails sur la manière d’utiliser les requêtes de contribution (« pull requests »).

## « Claiming » tickets

In an open-source project with hundreds of contributors around the world, it’s important to manage communication efficiently so that work doesn’t get duplicated and contributors can be as effective as possible.

Hence, our policy is for contributors to « claim » tickets in order to let other developers know that a particular bug or feature is being worked on.

If you have identified a contribution you want to make and you’re capable of fixing it (as measured by your coding ability, knowledge of Django internals and time availability), claim it by following these steps:

- Login using your GitHub account or create an account in our ticket system. If you have an account but have forgotten your password, you can reset it using the password reset page.
- Si un ticket pour ce problème n’existe pas encore, créez-en un dans notre système de suivi des tickets.
- Si un ticket pour ce problème existe déjà, assurez-vous que personne ne s’en occupe déjà. Pour cela, examinez la section `Owned by` du ticket. S’il est attribué à `nobody`, c’est qu’il est disponible. Sinon, quelqu’un d’autre est probablement en train de travailler sur ce ticket. Cherchez alors un autre bogue ou fonctionnalité ou contactez le développeur travaillant sur le ticket pour offrir votre aide. Si un ticket est attribué à quelqu’un depuis des semaines ou mois sans activité, il peut sans doute vous être attribué sans risque de conflit.
- Log into your account, if you haven’t already, by clicking « GitHub Login » or « DjangoProject Login » in the upper left of the ticket page.
- Claim the ticket by clicking the « assign to myself » radio button under « Action » near the bottom of the page, then click « Submit changes. »

Note

The Django software foundation requests that anyone contributing more than a trivial patch to Django sign and submit a Contributor License Agreement, this ensures that the Django Software Foundation has clear license to all contributions allowing for a clear license for all users.

### Ticket claimers” responsibility

Once you’ve claimed a ticket, you have a responsibility to work on that ticket in a reasonably timely fashion. If you don’t have time to work on it, either unclaim it or don’t claim it in the first place!

If there’s no sign of progress on a particular claimed ticket for a week or two, another developer may ask you to relinquish the ticket claim so that it’s no longer monopolized and somebody else can claim it.

If you’ve claimed a ticket and it’s taking a long time (days or weeks) to code, keep everybody updated by posting comments on the ticket. If you don’t provide regular updates, and you don’t respond to a request for a progress report, your claim on the ticket may be revoked.

As always, more communication is better than less communication!

### Which tickets should be claimed?

Going through the steps of claiming tickets is overkill in some cases.

In the case of small changes, such as typos in the documentation or small bugs that will only take a few minutes to fix, you don’t need to jump through the hoops of claiming tickets. Submit your patch directly and you’re done!

It is always acceptable, regardless whether someone has claimed it or not, to submit patches to a ticket if you happen to have a patch ready.

## Style des correctifs

Assurez-vous que toute contribution remplit au minimum les exigences suivantes :

- The code required to fix a problem or add a feature is an essential part of a patch, but it is not the only part. A good patch should also include a regression test to validate the behavior that has been fixed and to prevent the problem from arising again. Also, if some tickets are relevant to the code that you’ve written, mention the ticket numbers in some comments in the test so that one can easily trace back the relevant discussions after your patch gets committed, and the tickets get closed.
- If the code associated with a patch adds a new feature, or modifies behavior of an existing feature, the patch should also contain documentation.

When you think your work is ready to be reviewed, send a GitHub pull request. Please review the patch yourself using our patch review checklist first.

If you can’t send a pull request for some reason, you can also use patches in Trac. When using this style, follow these guidelines.

- Submit patches in the format returned by the `git diff` command.
- Attach patches to a ticket in the ticket tracker, using the « attach file » button. Please don’t put the patch in the ticket description or comment unless it’s a single line patch.
- Name the patch file with a `.diff` extension; this will let the ticket tracker apply correct syntax highlighting, which is quite helpful.

Regardless of the way you submit your work, follow these steps.

- Make sure your code fulfills the requirements in our patch review checklist.
- Check the « Has patch » box on the ticket and make sure the « Needs documentation », « Needs tests », and « Patch needs improvement » boxes aren’t checked. This makes the ticket appear in the « Patches needing review » queue on the Development dashboard.

## Non-trivial patches

A « non-trivial » patch is one that is more than a small bug fix. It’s a patch that introduces Django functionality and makes some sort of design decision.

If you provide a non-trivial patch, include evidence that alternatives have been discussed on django-developers.

If you’re not sure whether your patch should be considered non-trivial, ask on the ticket for opinions.

## Deprecating a feature

Il existe plusieurs raisons pour que du code Django soit rendu obsolète :

- Si une fonctionnalité a été améliorée ou modifiée de manière non rétrocompatible, l’ancienne fonctionnalité ou comportement sera rendu obsolète.
- Il peut arriver que Django inclue un rétroportage d’une bibliothèque Python qui ne fait pas encore partie d’une version de Python prise en charge actuellement par Django. Lorsque Django n’a plus besoin de prendre en charge l’ancienne version de Python qui nécessitait d’inclure cette bibliothèque, l’inclusion de celle-ci sera rendue obsolète dans Django.

As the deprecation policy describes, the first release of Django that deprecates a feature (`A.B`) should raise a `RemovedInDjangoXXWarning` (where XX is the Django version where the feature will be removed) when the deprecated feature is invoked. Assuming we have good test coverage, these warnings are converted to errors when running the test suite with warnings enabled: `python -Wa runtests.py`. Thus, when adding a `RemovedInDjangoXXWarning` you need to eliminate or silence any warnings generated when running the tests.

The first step is to remove any use of the deprecated behavior by Django itself. Next you can silence warnings in tests that actually test the deprecated behavior by using the `ignore_warnings` decorator, either at the test or class level:

1. In a particular test:

       from django.test import ignore_warnings
       from django.utils.deprecation import RemovedInDjangoXXWarning

       @ignore_warnings(category=RemovedInDjangoXXWarning)
       def test_foo(self):
           ...

2. For an entire test case:

       from django.test import ignore_warnings
       from django.utils.deprecation import RemovedInDjangoXXWarning

       @ignore_warnings(category=RemovedInDjangoXXWarning)
       class MyDeprecatedTests(unittest.TestCase):
           ...

You can also add a test for the deprecation warning:

    from django.utils.deprecation import RemovedInDjangoXXWarning

    def test_foo_deprecation_warning(self):
        msg = 'Expected deprecation message'
        with self.assertWarnsMessage(RemovedInDjangoXXWarning, msg):
            # invoke deprecated behavior

Finally, there are a couple of updates to Django’s documentation to make:

1. If the existing feature is documented, mark it deprecated in documentation using the `.. deprecated:: A.B` annotation. Include a short description and a note about the upgrade path if applicable.
2. Add a description of the deprecated behavior, and the upgrade path if applicable, to the current release notes (`docs/releases/A.B.txt`) under the « Features deprecated in A.B » heading.
3. Ajoutez une ligne dans la planification d’obsolescence (`docs/internals/deprecation.txt`) sous la version adéquate en indiquant le code qui sera supprimé.

Once you have completed these steps, you are finished with the deprecation. In each feature release, all `RemovedInDjangoXXWarning`s matching the new version are removed.

## Correctifs JavaScript

Pour des informations sur les correctifs JavaScript, consultez la documentation Correctifs JavaScript.

## Liste de contrôle de révision des correctifs

Use this checklist to review a pull request. If you are reviewing a pull request that is not your own and it passes all the criteria below, please set the « Triage Stage » on the corresponding Trac ticket to « Ready for checkin ». If you’ve left comments for improvement on the pull request, please tick the appropriate flags on the Trac ticket based on the results of your review: « Patch needs improvement », « Needs documentation », and/or « Needs tests ». As time and interest permits, committers do final reviews of « Ready for checkin » tickets and will either commit the patch or bump it back to « Accepted » if further works need to be done. If you’re looking to become a committer, doing thorough reviews of patches is a great way to earn trust.

Looking for a patch to review? Check out the « Patches needing review » section of the Django Development Dashboard. Looking to get your patch reviewed? Ensure the Trac flags on the ticket are set so that the ticket appears in that queue.

### Documentation

- Est-ce que la documentation peut être construite sans erreur (`make html` ou `make.bat html` sur Windows, à partir du répertoire `docs`) ?
- Est-ce que la documentation respecte les lignes directrices de style d’écriture de Écrire la documentation?
- Y a-t-il des fautes d’orthographe?

### Bogues

- Y a-t-il un test de régression approprié (le test doit échouer avant l’application de la correction) ?
- S’il s’agit d’un bogue qui est susceptible d’être rétroporté vers la version stable de Django, existe-t-il une note de publication dans `docs/releases/A.B.C.txt`? Les corrections de bogues qui ne s’appliquent qu’à la branche `master` n’ont pas besoin d’une note de publication.

### Nouvelles fonctionnalités

- Y a-t-il des tests qui « éprouvent » la totalité du nouveau code ?
- Existe-t-il une note de publication dans `docs/releases/A.B.txt`?
- La fonctionnalité est-elle documentée et est-elle annotée convenablement avec `.. versionadded:: A.B` ou `.. versionchanged:: A.B`?

### Deprecating a feature

Consultez le guide Deprecating a feature.

### Toutes les modifications de code

- Est-ce que le style du code est conforme à nos lignes directrices ? Le code produit-il des erreurs `flake8`?
- Si la modification n’est pas rétrocompatible d’une quelconque manière, existe-t-il une note de publication appropriée (dans `docs/releases/A.B.txt`) ?
- Est-ce que la suite de tests de Django passe ?

### Tous les tickets

- La requête de contribution est-elle un seul commit fusionné avec un message respectant notre format des messages de commit?
- Êtes-vous l’auteur du commit et un nouveau contributeur ? Veuillez vous ajouter dans le fichier `AUTHORS` et soumettre un Contributor License Agreement (accord de licence de contribution).