---
title: "Menulis dokumentasi"
version: 1.9
locale: id
source: https://docs.djangoproject.com/id/1.9/internals/contributing/writing-documentation/
canonical: https://djangodocs.dev/id/1.9/internals/contributing/writing-documentation/
---
# Menulis dokumentasi

We place a high importance on consistency and readability of documentation.
After all, Django was created in a journalism environment! So we treat our
documentation like we treat our code: we aim to improve it as often as
possible.

Dokumentasi berubah secara umum datang dalam dua bentuk:

- Perbaikan umum: pembenaran kesalahan ketik, perbaikan kesalahan dan penjelasan lebih baik melalui penulisan lebih jelas dan lebih contoh.
- Fitur baru: dokumentasi dari ditur yang telah ditambahkan ke kerangka kerja sejak terbitan terakhir.

This section explains how writers can craft their documentation changes
in the most useful and least error-prone ways.

## Mendapatkan dokumentasi mentah

Though Django's documentation is intended to be read as HTML at
<https://docs.djangoproject.com/>, we edit it as a collection of text files for
maximum flexibility. These files live in the top-level `docs/` directory of a
Django release.

If you'd like to start contributing to our docs, get the development version of
Django from the source code repository
(see [Installing the development version](/id/1.9/topics/install/#installing-development-version)). The development version has the
latest-and-greatest documentation, just as it has latest-and-greatest code.
We also backport documentation fixes and improvements, at the discretion of the
committer, to the last release branch. That's because it's highly advantageous
to have the docs for the last release be up-to-date and correct (see
[Perbedaan diantara versi](/id/1.9/intro/whatsnext/#differences-between-doc-versions)).

## Mulai dengan Sphinx

Django's documentation uses the [Sphinx](http://sphinx-doc.org/) documentation system, which in turn
is based on [docutils](http://docutils.sourceforge.net/). The basic idea is that lightly-formatted plain-text
documentation is transformed into HTML, PDF, and any other output format.

To actually build the documentation locally, you'll currently need to install
Sphinx -- `pip install Sphinx` should do the trick.

Kemudian, membangun HTML sangat mudah; cukup `make html` (atau `make.bat html` pada Windows) dari direktori `docs`.

Untuk mulai membantu, anda akan ingin membaca  [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#rst-primer). Setelah itu, anda akan ingin membaca tentang Sphinx-specific markup yang digunakan untuk mengelola meta data, pengindeksan, dan acuan-silang.

## Bagaimana dokumentasi diatur

Dokumentasi disusun kedalam beberapa kategori:

- [Tutorials](/id/1.9/intro/) membawa pembaca dengan tangan melalui rangkaian langkah-langkah untuk membuat sesuatu.

  Hal terpenting dalam tutorial ini adalah membantu pembaca mendapatkan sesuatu berguna,  lebih disukai seawal mungkin, agar memberikan mereka rasa nyaman.

  Explain the nature of the problem we're solving, so that the reader
  understands what we're trying to achieve. Don't feel that you need to begin
  with explanations of how things work - what matters is what the reader does,
  not what you explain. It can be helpful to refer back to what you've done and
  explain afterwards.
- [Topic guides](/id/1.9/topics/) bertujuan untuk menjelaskan konsep atau subjek pada tingkatan yang cukup tinggi.

  Link to reference material rather than repeat it. Use examples and don't be
  reluctant to explain things that seem very basic to you - it might be the
  explanation someone else needs.

  Menyediakan konteks latar belakang membantu pendatang baru menghubungkan topik ke hal-hal yang mereka sudah ketahui.
- [Reference guides](/id/1.9/ref/) mengandung acuan teknis untuk API. Mereka menggambarkan fungsi dari perlengkapan dalam Django dan petunjuk dalam penggunaannya.

  Keep reference material tightly focused on the subject. Assume that the
  reader already understands the basic concepts involved but needs to know or
  be reminded of how Django does it.

  Reference guides aren't the place for general explanation. If you find
  yourself explaining basic concepts, you may want to move that material to a
  topic guide.
- [How-to guides](/id/1.9/howto/) adalah resep yang membawa pembaca melalui langkah-langkah dalam subjek kunci.

  What matters most in a how-to guide is what a user wants to achieve.
  A how-to should always be result-oriented rather than focused on internal
  details of how Django implements whatever is being discussed.

  These guides are more advanced than tutorials and assume some knowledge about
  how Django works. Assume that the reader has followed the tutorials and don't
  hesitate to refer the reader back to the appropriate tutorial rather than
  repeat the same material.

## Gaya menulis

When using pronouns in reference to a hypothetical person, such as "a user with
a session cookie", gender neutral pronouns (they/their/them) should be used.
Instead of:

- dia laki-laki atau dia perempuan... gunakan mereka
- dia laki-laki atau dia perempuan... gunakan mereka
- dia laki-laki atau dia perempuan... gunakan mereka
- dia laki-laki atau dia perempuan... gunakan mereka
- dia laki-laki atau dia perempuan... gunakan mereka

## Istilah umum digunakan

Ini adalah beberapa panduan pada istilah paling umum digunakan sepanjang dokumentasi:

- **Django** -- ketika mengacukan ke kerangka kerja, huruf besarkan Django. Huruf kecil hanya dalam kode Python dan dalam logo djangoproject.com.
- **email** -- tanpa tanda penghubung
- **MySQL**, **PostgreSQL**, **SQLite**
- **SQL** -- when referring to SQL, the expected pronunciation should be
  "Ess Queue Ell" and not "sequel". Thus in a phrase like "Returns an
  SQL expression", "SQL" should be preceded by "an" and not "a".
- **Python** -- when referring to the language, capitalize Python.
- **realize**, **customize**, **initialize**, etc. -- use the American
  "ize" suffix, not "ise."
- **subclass** -- it's a single word without a hyphen, both as a verb
  ("subclass that model") and as a noun ("create a subclass").
- **Web**, **World Wide Web**, **the Web** -- note Web is always
  capitalized when referring to the World Wide Web.
- **website** -- gunakan satu kata, tanpa huruf besar.

## Django-specific terminology

- **model** -- itu tidak huruf besar.
- **template** -- itu tidak huruf besar.
- **URLconf** -- gunakan tiga huruf besar, tanpa ruang sebelum "conf."
- **view** -- itu tidak huruf besar.

## Panduan untuk berkas-berkas reStructuredText

Panduan ini mengatur bentuk dari dokumentasi dari reST (reStructuredText) kami:

- In section titles, capitalize only initial words and proper nouns.
- Wrap the documentation at 80 characters wide, unless a code example
  is significantly less readable when split over two lines, or for another
  good reason.
- The main thing to keep in mind as you write and edit docs is that the
  more semantic markup you can add the better. So:

  ```
  Add ``django.contrib.auth`` to your ``INSTALLED_APPS``...
  ```

  Isn't nearly as helpful as:

  ```
  Add :mod:`django.contrib.auth` to your :setting:`INSTALLED_APPS`...
  ```

  This is because Sphinx will generate proper links for the latter, which
  greatly helps readers. There's basically no limit to the amount of
  useful markup you can add.
- Gunakan [`intersphinx`](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#module-sphinx.ext.intersphinx) untuk mengacu dokumentasi Python and Sphinx'.
- Gunakan gaya kepala ini:

  ```
  ===
  One
  ===

  Two
  ===

  Three
  -----

  Four
  ~~~~

  Five
  ^^^^
  ```

## Django-specific markup

Besides the Sphinx built-in markup, Django's
docs defines some extra description units:

- Pengaturan:

  ```
  .. setting:: INSTALLED_APPS
  ```

  To link to a setting, use `` :setting:`INSTALLED_APPS` ``.
- Cetakan etiket:

  ```
  .. templatetag:: regroup
  ```

  Untuk mengkaitkan, gunakan `` :ttag:`regroup` ``.
- Cetakan penyaring:

  ```
  .. templatefilter:: linebreaksbr
  ```

  To link, use `` :tfilter:`linebreaksbr` ``.
- Field lookups (i.e. `Foo.objects.filter(bar__exact=whatever)`):

  ```
  .. fieldlookup:: exact
  ```

  Untuk mengkaitkan, gunakan `` :lookup:`exact` ``.
- Perintah `django-admin`:

  ```
  .. django-admin:: migrate
  ```

  Untuk mengkaitkan, gunakan `` :djadmin:`migrate` ``.
- Pilihan baris-perintah `django-admin`:

  ```
  .. django-admin-option:: --traceback
  ```

  To link, use `` :option:`command_name --traceback` `` (or omit `command_name`
  for the options shared by all commands like `--verbosity`).
- Links to Trac tickets (typically reserved for patch release notes):

  ```
  :ticket:`12345`
  ```

## Mendokumentasikan fitur baru

Kebijakan kami untuk fitur baru adalah:

> All documentation of new features should be written in a way that
> clearly designates the features are only available in the Django
> development version. Assume documentation readers are using the latest
> release, not the development version.

Our preferred way for marking new features is by prefacing the features'
documentation with: "`.. versionadded:: X.Y`", followed by a mandatory
blank line and an optional description (indented).

General improvements, or other changes to the APIs that should be emphasized
should use the "`.. versionchanged:: X.Y`" directive (with the same format
as the `versionadded` mentioned above.

These `versionadded` and `versionchanged` blocks should be "self-contained."
In other words, since we only keep these annotations around for two releases,
it's nice to be able to remove the annotation and its contents without having
to reflow, reindent, or edit the surrounding text. For example, instead of
putting the entire description of a new or changed feature in a block, do
something like this:

```
.. class:: Author(first_name, last_name, middle_name=None)

    A person who writes books.

    ``first_name`` is ...

    ...

    ``middle_name`` is ...

    .. versionchanged:: A.B

        The ``middle_name`` argument was added.
```

Put the changed annotation notes at the bottom of a section, not the top.

Also, avoid referring to a specific version of Django outside a
`versionadded` or `versionchanged` block. Even inside a block, it's often
redundant to do so as these annotations render as "New in Django A.B:" and
"Changed in Django A.B", respectively.

If a function, attribute, etc. is added, it's also okay to use a
`versionadded` annotation like this:

```
.. attribute:: Author.middle_name

    .. versionadded:: A.B

    An author's middle name.
```

We can simply remove the `.. versionadded:: A.B` annotation without any
indentation changes when the time comes.

## Mengecilkan gambar

Optimize image compression where possible. For PNG files, use OptiPNG and
AdvanceCOMP's `advpng`:

```console
$ cd docs/
$ optipng -o7 -zm1-9 -i0 -strip all `find . -type f -not -path "./_build/*" -name "*.png"`
$ advpng -z4 `find . -type f -not -path "./_build/*" -name "*.png"`
```

This is based on OptiPNG version 0.7.5. Older versions may complain about the
`--strip all` option being lossy.

## Sebuah contoh

For a quick example of how it all fits together, consider this hypothetical
example:

- First, the `ref/settings.txt` document could have an overall layout
  like this:

  ```rst
  ========
  Settings
  ========

  ...

  .. _available-settings:

  Available settings
  ==================

  ...

  .. _deprecated-settings:

  Deprecated settings
  ===================

  ...
  ```
- Next, the `topics/settings.txt` document could contain something like
  this:

  ```rst
  You can access a :ref:`listing of all available settings
  <available-settings>`. For a list of deprecated settings see
  :ref:`deprecated-settings`.

  You can find both in the :doc:`settings reference document
  </ref/settings>`.
  ```

  We use the Sphinx [`doc`](https://www.sphinx-doc.org/en/master/usage/referencing.html#role-doc) cross reference element when we want to
  link to another document as a whole and the [`ref`](https://www.sphinx-doc.org/en/master/usage/referencing.html#role-ref) element when
  we want to link to an arbitrary location in a document.
- Next, notice how the settings are annotated:

  ```rst
  .. setting:: ADMINS

  ADMINS
  ======

  Default: ``[]`` (Empty list)

  A list of all the people who get code error notifications. When
  ``DEBUG=False`` and a view raises an exception, Django will email these people
  with the full exception information. Each member of the list should be a tuple
  of (Full name, email address). Example::

      [('John', 'john@example.com'), ('Mary', 'mary@example.com')]

  Note that Django will email *all* of these people whenever an error happens.
  See :doc:`/howto/error-reporting` for more information.
  ```

  This marks up the following header as the "canonical" target for the
  setting `ADMINS`. This means any time I talk about `ADMINS`,
  I can reference it using `` :setting:`ADMINS` ``.

That's basically how everything fits together.

## Memperbaharui dokumentasi

Sedikit perbaharuan kecil dapat dibuat untuk membuat dokumentasi dibaca dan kelihatan lebih baik:

- Most of the various `index.txt` documents have *very* short or even
  non-existent intro text. Each of those documents needs a good short
  intro the content below that point.
- The glossary is very perfunctory. It needs to be filled out.
- Add more metadata targets. Lots of places look like:

  ```
  ``File.close()``
  ~~~~~~~~~~~~~~~~
  ```

  ... ini seharusnya menjadi:

  ```
  .. method:: File.close()
  ```

  Yaitu, gunakan metadata daripada judul.
- Jika memungkinkan, gunakan kaitan. Jadi gunakan `` :setting:`ADMINS` `` daripada ``` ``ADMINS`` ```.
- Use directives where appropriate. Some directives
  (e.g. `.. setting::`) are prefix-style directives; they go *before*
  the unit they're describing. These are known as "crossref" directives.
  Others (e.g. `.. class::`) generate their own markup; these should go
  inside the section they're describing. These are called
  "description units".

  You can tell which are which by looking at in
  `_ext/djangodocs.py`; it registers roles as one of the other.
- Add `.. code-block:: <lang>` to literal blocks so that they get
  highlighted.
- When referring to classes/functions/modules, etc., you'll want to use
  the fully-qualified name of the target
  (`` :class:`django.contrib.contenttypes.models.ContentType` ``).

  Since this doesn't look all that awesome in the output -- it shows the
  entire path to the object -- you can prefix the target with a `~`
  (that's a tilde) to get just the "last bit" of that path. So
  `` :class:`~django.contrib.contenttypes.models.ContentType` `` will just
  display a link with the title "ContentType".

## Pemeriksaan ejaan

Before you commit your docs, it's a good idea to run the spelling checker.
You'll need to install a couple packages first:

- [pyenchant](https://pypi.python.org/pypi/pyenchant/) (which requires
  [enchant](http://www.abisource.com/projects/enchant/))
- [sphinxcontrib-spelling](https://pypi.python.org/pypi/sphinxcontrib-spelling/)

Then from the `docs` directory, run `make spelling`. Wrong words (if any)
along with the file and line number where they occur will be saved to
`_build/spelling/output.txt`.

If you encounter false-positives (error output that actually is correct), do
one of the following:

- Surround inline code or brand/technology names with grave accents (\`).
- Find synonyms that the spell checker recognizes.
- If, and only if, you are sure the word you are using is correct - add it
  to `docs/spelling_wordlist` (please keep the list in alphabetical order).

## menterjemahkan dokumentasi

See [Localizing the Django documentation](/id/1.9/internals/contributing/localizing/#translating-documentation) if
you'd like to help translate the documentation into another language.

## `django-admin` man page

Sphinx can generate a manual page for the
[django-admin](/id/1.9/ref/django-admin/) command. This is configured in
`docs/conf.py`. Unlike other documentation output, this man page should be
included in the Django repository and the releases as
`docs/man/django-admin.1`. There isn't a need to update this file when
updating the documentation, as it's updated once as part of the release process.

To generate an updated version of the man page, run `make man` in the
`docs` directory. The new man page will be written in
`docs/_build/man/django-admin.1`.
