Mengajukan tambalan

Kami semua selalu berterima kasih untuk tambalan-tambalan pada kode Django. Memang, laporan kesalahan dengan tambalan terhubung akan diperbaiki jauh lebih cepat daripada mereka yang tanpa tambalan.

Perbaikan kesalahan ketik dan perubahan dokumentasi sepele.

Jika anda sedang memperbaiki masalah sepele, sebagai contoh merubah sebuah kata di dokumentasi, cara dipilih untuk menyediakan tambalan adalah menggunakan menarik permintaan Github tanpa tiket Trac.

Lihat Bekerja dengan Git dan GitHub untuk tincian lebih bagaimana menggunakan penarian permintaan.

Tiket “Meminta”

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.
  • Jika sebuah tiket untuk masalah ini belum ada, buat satu di ticket tracker kami.

  • If a ticket for this issue already exists, make sure nobody else has claimed it. To do this, look at the “Owned by” section of the ticket. If it’s assigned to “nobody,” then it’s available to be claimed. Otherwise, somebody else may be working on this ticket. Either find another bug/feature to work on, or contact the developer working on the ticket to offer your help. If a ticket has been assigned for weeks or months without any activity, it’s probably safe to reassign it to yourself.
  • 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.”

Catatan

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.

Seperti biasa, komunikasi lebih lebih baik dati pada komunikasi kurang!

Tiket mana harus diminta?

Of course, 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. Just submit your patch and be done with it.

Of course, 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.

Gaya tambalan

Make sure that any contribution you do fulfills at least the following requirements:

  • 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.

  • Ajukan tambalan-tambalan dalam bentuk dikembalikan oleh perintah git diff.

  • Lampirkan tambalan ke sebuah tiket dalam ticket tracker, menggunakan tombol “attach file”. Tolong jangan taruh tambalan dalam gambaran tiket atau komentar meskipun dia hanya sebuah tambalan baris tunggal.

  • Nama berkas tambalan dengan perpanjangan .diff; ini akan membuat pelacak tiket memberlakukan penyorotan sintaksis benar, yang tentunya sangat membantu.

Tanpa memperhatikan cara anda mengajukan pekerjaan anda, ikuti langkah-langkah ini.

  • Pastikan anda memenuhi persyaratan di daftar centang pratinjau tambalan kami.

  • 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.

Tambalan bukan sepele

Tambalan “bukan-sepele” adalah satu yang lebih dari sebuah perbaikan kesalahan sederhana. Itu adalah sebuah tambalan yang memperkenalkan fungsi Django dan membuat beberapa urutan keputusan rancangan.

Jika anda menyediakan tambalan bukan-sepele, sertakan saksi yang jalan lain telah diobrolkan di django-developers.

Jika anda tidak yakin apakah tambalan anda harus dipertimbangkan bukan-sepele, tanya saja.

Mengusangkan fitur

Terdapat beberapa alasan bahwa kode di Django mungkin diusangkan:

  • Jika sebuah fitur telah ditingkatkan atau dirubah di cara ketidaksesuaian-kebelakang, fitur atau kebiasaan lama akan diusangkan.

  • Sometimes Django will include a backport of a Python library that’s not included in a version of Python that Django currently supports. When Django no longer needs to support the older version of Python that doesn’t include the library, the library will be deprecated in 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 -Wall 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. Di percobaan khusus:

    from django.test import ignore_warnings
    from django.utils.deprecation import RemovedInDjangoXXWarning
    
    @ignore_warnings(category=RemovedInDjangoXXWarning)
    def test_foo(self):
        ...
    
  2. Untuk kasus percobaan keseluruhan:

    from django.test import ignore_warnings
    from django.utils.deprecation import RemovedInDjangoXXWarning
    
    @ignore_warnings(category=RemovedInDjangoXXWarning)
    class MyDeprecatedTests(unittest.TestCase):
        ...
    
Changed in Django 1.8:

Django versi sebelumnya mempunyai beberapa kelas Ignore*DeprecationWarningsMixin untuk mencegah peringatan dari kemunculan. Ini telah diganti dengan penghias ignore_warnings.

Anda dapat juga menambahkan sebuah percobaan untuk peringatan pengusangan. Anda harus meniadakan kebiasaan “peringatan sebagai kesalahan” di percobaan anda dengan melakukan:

import warnings

def test_foo_deprecation_warning(self):
    with warnings.catch_warnings(record=True) as warns:
        warnings.simplefilter('always')  # prevent warnings from appearing as errors
        # invoke deprecated behavior

    self.assertEqual(len(warns), 1)
    msg = str(warns[0].message)
    self.assertEqual(msg, 'Expected deprecation message')

Akhirnya, ada sepasang pembaharuan ke dokumentasi Django untuk dibuat:

  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. Add an entry in the deprecation timeline (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 RemovedInDjangoXXWarnings matching the new version are removed.

Tambalan JavaScript

Untuk informasi pada tambalan JavaScript, lihat dokumentasi Tambalan JavaScript.

Daftar centang pratinjau tambalan

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, core developers 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 core developer, 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.

Dokumentasi

  • Apakah dokumentasi dibangun tanpa kesalahan apapun (make html, atau make.bat html pada Windows, dari direktori docs)?

  • Apakah dokumentasi mengikuti panduan gaya penulisan dalam Menulis dokumentasi?

  • Apakah ada kesalahan pengejaan?

Kesalahan

  • Apakah ada percobaan pemulihan yang sesuai (percobaan harus gagal sebelum perbaikan diberlakukan)?

Fitur Baru

  • Are there tests to “exercise” all of the new code?
  • Apakah ada sebuah catatan terbitan di docs/releases/A.B.txt?

  • Apakah ada dokumentasi untuk fitur dan apakah dia dijelaskan dengan tepat dengan .. versionadded:: A.B atau .. versionchanged:: A.B?

Mengusangkan fitur

Lihat panduan Mengusangkan fitur.

Semua kode perubahan

  • Does the coding style conform to our guidelines? Are there any flake8 errors?
  • If the change is backwards incompatible in any way, is there a note in the release notes (docs/releases/A.B.txt)?
  • Is Django’s test suite passing? Ask in #django-dev for a core dev to build the pull request against our continuous integration server.

Semua tiket