我们总是感谢Django代码的补丁。确实,具有相关补丁的错误报告将比没有补丁的错误报告 更 快地得到修复。
If you are fixing a really trivial issue, for example changing a word in the documentation, the preferred way to provide the patch is using GitHub pull requests without a Trac ticket.
有关如何使用拉取请求的更多详细信息,请参见:doc:working-with-git
在一个全球有数百个贡献者的开源项目中,有效地管理沟通以避免重复工作并尽可能提高贡献者的效率是非常重要的。
因此,我们的政策是供贡献者“发布”工单,以便让其他开发人员知道正在处理特定的错误或功能。
如果您确定了要做出的贡献并且有能力解决(通过编程能力,Django内核知识水平和时间可用性来衡量),请按照以下步骤进行发表:
注解
Django软件基金会要求对Django贡献不小的补丁的人签署并提交 Contributor License Agreement 贡献者许可协议,以确保Django软件基金会对所有贡献都拥有明确的许可,从而为所有用户提供明确的许可。
发布工单后,您有责任以合理及时的方式处理该工单。 如果您没有时间来处理它,请先取消发布或不发布它!
如果一两周内没有任何关于特定已发布工单的进展迹象,则另一位开发人员可能会要求您放弃该发布了的工单,以使其不再被垄断,而其他人也可以发布。
如果您已发布工单,并且要花很长时间(几天或几周)编写代码,请通过在工单上发布评论来使每个人都保持最新状态。如果您不提供定期更新,并且不响应进度报告的请求,则您对工单的要求可能会被撤消。
与往常一样,多交流好过少交流!
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.
确保您所做的任何贡献至少满足以下要求:
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.
git diff
command..diff
命名补丁文件; 这将使工单跟踪系统应用正确的语法突出显示,这非常有帮助。无论您以何种方式提交工作成果,请按照以下步骤操作。
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.
There are a couple of reasons that code in Django might be deprecated:
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:
In a particular test:
from django.test import ignore_warnings
from django.utils.deprecation import RemovedInDjangoXXWarning
@ignore_warnings(category=RemovedInDjangoXXWarning)
def test_foo(self):
...
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:
.. deprecated:: A.B
annotation. Include a short description
and a note about the upgrade path if applicable.docs/releases/A.B.txt
) under
the "Features deprecated in A.B" heading.docs/internals/deprecation.txt
)
under the appropriate version describing what code will be removed.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.
For information on JavaScript patches, see the JavaScript patches documentation.
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.
make html
, or
make.bat html
on Windows, from the docs
directory)?docs/releases/A.B.C.txt
? Bug fixes that will be applied only to the main
branch don't need a release note.docs/releases/A.B.txt
?.. versionadded:: A.B
or .. versionchanged:: A.B
?See the Deprecating a feature guide.
flake8
errors? You can install the
pre-commit hooks to automatically catch
these errors.docs/releases/A.B.txt
)?AUTHORS
file and submit a Contributor License Agreement.5月 26, 2021