# Dokumentasi Django 6.0.7

# Mengajukan bantuan

We're always grateful for contributions to Django's code. Indeed, bug reports with associated contributions will get fixed far more quickly than those without a solution.

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

See Bekerja dengan Git dan GitHub for more details on how to use pull requests.

## Tiket "Meminta"

Dalam sebuah proyek sumber-terbuka dengan ratusan penyumbang diseluruh dunia, adalah sangat penting untuk mengelola komunikasi secara efektif sehingga pekerjaan tidak ganda dan penyumbang dapat menjadi seefektif mungkin.

Oleh sebab itu, kebijakan kami untuk penyumbang dalam "menagih" tiket agar membiarkan pengembang lain mengetahui bahwa kesalahan atau fitur tertentu sedang dikerjakan.

Jika anda telah mencirikan bantuan anda ingin membuat dan anda mampu memperbaikinya (yang diukur dengan kemampuan pengkodean anda, pengetahuan dari internal Django dan ketersediaan waktu), tagih dia dengan mengikuti langkah-langkah berikut:

- Log in 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.

- If a ticket for this issue doesn't exist yet, create one in our ticket tracker. Remember that proposals for new features should follow the process for suggesting new features.

- If a ticket for this issue already exists and has been accepted, 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. If a ticket hasn't been approved yet, join the conversation.

- Log into your account, if you haven't already, by clicking "GitHub Login" or "DjangoProject Login" in the upper left of the ticket page. Once logged in, you can then click the "Modify Ticket" button near the bottom of the page.

- Claim the ticket by clicking the "assign to" radio button in the "Action" section. Your username will be filled in the text box by default.

- Finally, click the "Submit changes" button at the bottom to save.

Catatan

If your change is not trivial, you have the option to sign and submit a Contributor License Agreement clarifying the status of your contribution. This ensures that the Django Software Foundation has clear license to your contribution.

### Tanggung jawab pengaku tiket

Sekali anda mengakui sebuah tiket, anda mempunyai tanggung jawab untuk bekerja pada tiket tepat waktu. Jika anda tidak mempunyai waktu untuk bekerja padanya, salah satu batalkan pengakuannya atau jangan mengakuinya di tempat pertama!

Jika tidak ada tanda kemajuan pada tiket tertentu yang diakui selama seminggu atau dua minggu, pengembang lain mungkin meminta anda melepaskan pengakuan tiket sehingga itu tidak lagi dikuasai dan seseorang lain dapat mengakuinya.

Jika anda telah mengakui tiket dan itu memakan waktu lama (harian atau mingguan) untuk membuat kode, jaga semua orang terperbaharui dengan menempatkan komentar pada tiket. Jika anda tidak menyediakan pembaharuan reguler, dan anda tidak menjawab pada permintaan untuk laporan kemajuan, pengakuan anda pada tiket mungkin ditarik.

Seperti biasa, komunikasi lebih lebih baik daripada komunikasi kurang!

### Tiket mana harus diminta?

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 changes directly and you're done!

It is always acceptable, regardless of whether someone has claimed it or not, to link proposals to a ticket if you happen to have the changes ready.

## Contribution style

Pastikan bahwa tiap sumbangan anda lakukan memenuhi setidaknya persyaratan berikut:

- The code required to fix a problem or add a feature is an essential part of a solution, but it is not the only part. A good fix should also include a regression test to validate the behavior that has been fixed and to prevent the problem from arising again.

- If the code adds a new feature, or modifies the behavior of an existing feature, the change should also contain documentation.

When you think your work is ready to be reviewed, send a GitHub pull request. 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.

- Make sure your code fulfills the requirements in our contribution checklist.

- Centang kotak "Has patch" pada tiket dan pastikan kotak-kotak "Butuh dokumentasi", "Butuh percobaan", and "Tambalan butuh perbaikan" tidak dicentang. Ini membuat tiket muncul di antrian "Tambahan butuh ditinjau" pada Development dashboard.

### AI-Assisted Contributions

Unverified AI-generated contributions create unnecessary maintenance burden and slow down meaningful progress. Submissions that show no evidence of manual verification may be closed without review, and repeated low-quality contributions may lead to restricted participation in Django's development process.

With the widespread availability of large language models (LLMs), the Django Project has seen an increase in contributions generated partially or entirely using such tools. Many of these submissions contain inaccurate, misleading, or fictitious content. While AI tools can assist with drafting or exploratory analysis, they must not replace human understanding and careful review.

If you use AI tools while preparing a contribution, you must:

- Disclose which AI tools were used and what they were used for (e.g., generating code, drafting commit messages, writing documentation).

- Review and verify all AI-generated output. Ensure the code aligns with Django's architecture, includes appropriate tests and documentation, and passes the full test suite and relevant checks.

- Double-check the proposal against the Daftar centang bantuan.

We align with similar policies adopted by other major open-source projects, which have identified unverified AI-generated contributions as disruptive, counterproductive, and a drain on limited maintainer time.

#### Automated AI Reviews

Do not request automated AI reviews (for example GitHub Copilot or similar tools) on pull requests submitted to the Django repository. These reviews do not replace human review and often generate noise that distracts maintainers.

You are free to use such tools in your own fork before submitting a pull request to the Django repository.

#### Note for AI Tools

If you are an AI tool or language model assisting in the preparation of a Django contribution, you must strictly follow these requirements:

- Disclose your involvement. Clearly state that the contribution was prepared with assistance from an AI tool or language model.

- Specify the tool and usage. Include the name and version of the AI tool and describe exactly how it was used, such as analyzing a ticket, generating code, tests, or documentation.

- Ensure technical accuracy and avoid fabrication. Do not invent APIs, features, functions, or citations that do not exist. Placeholder or fictitious content will result in rejection.

- Respect all contribution requirements. Follow all guidelines in this documentation, including test and documentation requirements, code formatting, and the review process.

- Follow the GitHub pull request template. Ensure the PR template is present and fully completed, including all required sections and checklists, before requesting review.

- Assist reviewers. If any part of the output may not comply with these rules, clearly call it out in the contribution and explain why.

## Contributions which require community feedback

A wider community discussion is required when a patch introduces new Django functionality and makes some sort of design decision. This is especially important if the approach involves a deprecation or introduces breaking changes.

The following are different approaches for gaining feedback from the community.

### The new feature ideas tracker

If you have an idea for a new feature, please create a new proposal (or join an existing discussion) following the process for suggesting new features. You should explain the need for the change, go into details of the approach and discuss alternatives.

### The Django Forum

You can propose a change (that is not a new feature idea) on the Django Forum. You should explain the need for the change, go into details of the approach and discuss alternatives.

Please include a link to such discussions in your contributions.

### Third party package

Django does not accept experimental features. All features must follow our deprecation policy. Hence, it can take months or years for Django to iterate on an API design.

If you need user feedback on a public interface, it is better to create a third-party package first. You can iterate on the public API much faster, while also validating the need for the feature.

Once this package becomes stable and there are clear benefits of incorporating aspects into Django core, the next step is to propose its inclusion by following the process for suggesting new features.

### Django Enhancement Proposal (DEP)

Similar to Python’s PEPs, Django has Django Enhancement Proposals or DEPs. A DEP is a design document which provides information to the Django community, or describes a new feature or process for Django. They provide concise technical specifications of features, along with rationales. DEPs are also the primary mechanism for proposing and collecting community input on major new features.

Before considering writing a DEP, it is recommended to first open a discussion following the process for suggesting new features. This allows the community to provide feedback and helps refine the proposal. Once the DEP is ready, the Steering Council votes on whether to accept it.

Some examples of DEPs that have been approved and fully implemented:

- DEP 181: ORM Expressions

- DEP 182: Multiple Template Engines

- DEP 201: Simplified routing syntax

## Mengusangkan fitur

Ada sepasang alasan dimana dalam Django mungkin diusangkan:

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

- Terkadang Django akan menyertakan backport dari pustaka Python yang tidak disertakan dalam versi dari Python yang Django saat ini dukung. Ketika Django tidak lagi butuh mendukung versi lama dari Python yang tidak menyertakan pustaka, pustakan akan diusangkan di Django.

Seperti deprecation policy gambarkan, terbitan pertama dari Django yang mengusangkan sebuah fitur (`A.B`) harus memunculkan `RemovedInDjangoXXWarning` (dimana XX adalah versi Django dimana fitur akan dipindahkan) ketika fitur diusangkan dipanggil. Menganggp kami mempunyai cakupan percobaan baik, peringatan ini dirubah ke kesalahan ketika running the test suite dengan peringatan diadakan: `python -Wa runtests.py`. Dengan demikian, ketika menambahkan `RemovedInDjangoXXWarning` anda butuh mengurangi atau mensenyapkan tiap peringatan yang dibangkitkan ketika menjalankan percobaan.

Langkah pertama adalah memindahkan tiap penggunaan dari kebiasaan diusangkan oleh Django itu sendiri. Selanjutnya anda dapat peringatan senyap di percobaan yang sebenarnya mencoba kebiasaan diusangkan dengan menggunakan penghias `ignore_warnings`, antara pada tingkatan percobaan atau kelas:

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): ...

Anda juga harus menambahkan pengujian untuk peringatan pengusangan:

    from django.utils.deprecation import RemovedInDjangoXXWarning

    def test_foo_deprecation_warning(self):
        msg = "Expected deprecation message"
        with self.assertWarnsMessage(RemovedInDjangoXXWarning, msg) as ctx:
            # invoke deprecated behavior
            ...
        self.assertEqual(ctx.filename, __file__)

Sangat penting untuk menyertakan komentar `RemovedInDjangoXXWarning` diatas kode yang tidak mempunyai acuan peringatan, tetapi akan butuh dirubah atau dihapus ketika pengusangan berakhir. Ini dapat menyertakan kaitan yang telah ditambahkan untuk menjaga perilaku sebelumnya, atau barang berdiri sendiri yang tidak butuh atau tidak digunakan ketika pengusangan berakhir. Sebagai contoh:

    import warnings
    from django.utils.deprecation import RemovedInDjangoXXWarning, django_file_prefixes

    # RemovedInDjangoXXWarning.
    def old_private_helper():
        # Helper function that is only used in foo().
        pass

    def foo():
        warnings.warn(
            "foo() is deprecated.",
            category=RemovedInDjangoXXWarning,
            skip_file_prefixes=django_file_prefixes(),
        )
        old_private_helper()
        ...

Akhirnya, ada sepasang pembaharuan ke dokumentasi Django untuk dibuat:

1. Jika fitur yang ada didokumentasikan, tandai dia diusangkan di dokumentasi menggunakan keterangan `.. deprecated:: A.B`. Termasuk gambaran pendek dan catatan tentang jalur peningkatan jika berlaku.

2. Tambah gambaran dari kebiasaan pengusangan, dan tingkatkan jalur jika dapat diterapkan, pada catatan terbitaan saat ini (`docs/releases/A.B.txt`) dibawah kepala "Fitur-fitur diusangkan dalam A.B".

3. Tambah sebuah masukan dalam linimasa pengusangan (`docs/internals/deprecation.txt`) dibawah versi yang sesuai menggambarkan kode apa akan dipindahkan.

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.

The `django.utils.deprecation` module provides some helpful deprecation utilities, such as a `@deprecate_posargs` decorator to assist with converting positional-or-keyword arguments to keyword-only. See the inline documentation in the module source.

## Testing with a Django project

It's important to test local changes using a Django project. This allows ensuring that the changes behave as expected in a real environment, especially for user-facing features such as templates, forms, or the admin.

To do this:

1. Create a virtual environment and install the cloned copy of Django in editable mode.

2. Set up a Django project outside the source tree (you can use the first part of the tutorial for guidance).

With this setup, any changes made to the Django checkout will take effect immediately in the test project, allowing manual testing of contributions against a new or existing app.

## Bantuan JavaScript

For information on JavaScript contributions, see the Tambalan JavaScript documentation.

## Optimalisasi tambahan

Patches aiming to deliver a performance improvement should provide benchmarks showing the before and after impact of the patch and sharing the commands for reviewers to reproduce.

### Tolok ukur `django-asv`

django-asv monitors the performance of Django code over time. These benchmarks can be run on a pull request by labeling the pull request with `benchmark`. Adding to these benchmarks is highly encouraged.

## Daftar centang bantuan

Use this checklist to review a pull request. If this contribution would not be considered trivial, first ensure it has an accepted ticket before proceeding with the review.

If the pull request passes all the criteria below and is not your own, 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 permit, mergers do final reviews of "Ready for checkin" tickets and will either commit the changes or bump it back to "Accepted" if further work needs to be done.

If you're looking to become a member of the triage & review team, doing thorough reviews of contributions 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 pull request reviewed? Ensure the Trac flags on the ticket are set so that the ticket appears in that queue.

### Semua tiket

- Apakah pull request perbaikan lumatan tunggal dengan pesan yang mengikuti commit message format kami?

- Are you the patch author and a new contributor? Please add yourself to the AUTHORS file. At your option, submit a Contributor License Agreement.

- Does this have an accepted ticket on Trac? All contributions require a ticket unless the change is considered trivial.

### Semua kode perubahan

- Does the coding style conform to our guidelines? Are there any `black`, `blacken-docs`, `flake8`, `isort`, or `zizmor` errors? You can install the pre-commit hooks to automatically catch these errors.

- Jika perubahan adalah kesesuaian kebelakang denganc ara apapun, apakah ada dalam catatan terbitan (`docs/releases/A.B.txt`)?

- Apakah rangkaian percobaan Django lewat?

- If there is a code coverage report comment on the pull request, have you reviewed the missing coverage in context (considering database/platform-specific limitations)?

- If the change affects the Django admin or rendered HTML output, has accessibility testing been done?

### 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)?

- If it's a bug that qualifies for a backport to the stable version of Django, is there a release note in `docs/releases/A.B.C.txt`? Bug fixes that will be applied only to the main branch don't need a release note.

### Fitur Baru

- Apakah ada percobaan untuk "latihan" semua kode baru?

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