
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="id">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Etiket cetakan dan penyaring siap-pakai &#8212; dokumentasi Django 2.2.9.dev20191202104323</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <script type="text/javascript" src="../../_static/translations.js"></script>
    <link rel="index" title="Indeks" href="../../genindex.html" />
    <link rel="search" title="Pencarian" href="../../search.html" />
    <link rel="next" title="Bahasa cetakan Django: untuk pemrogram Python" href="api.html" />
    <link rel="prev" title="Bahasa cetakan Django" href="language.html" />



 
<script type="text/javascript" src="../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "#";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../index.html">dokumentasi Django 2.2.9.dev20191202104323</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../index.html">Home</a>  |
        <a title="Table of contents" href="../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../genindex.html">Index</a>  |
        <a title="Module index" href="../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="language.html" title="Bahasa cetakan Django">previous</a>
     |
    <a href="../index.html" title="Acuan API" accesskey="U">up</a>
   |
    <a href="api.html" title="Bahasa cetakan Django: untuk pemrogram Python">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-templates-builtins">
            
  <div class="section" id="s-built-in-template-tags-and-filters">
<span id="built-in-template-tags-and-filters"></span><h1>Etiket cetakan dan penyaring siap-pakai<a class="headerlink" href="#built-in-template-tags-and-filters" title="Link permanen untuk headline ini">¶</a></h1>
<p>This document describes Django's built-in template tags and filters. It is
recommended that you use the <a class="reference internal" href="../contrib/admin/admindocs.html"><span class="doc">automatic documentation</span></a>, if available, as this will also include
documentation for any custom tags or filters installed.</p>
<div class="section" id="s-built-in-tag-reference">
<span id="s-ref-templates-builtins-tags"></span><span id="built-in-tag-reference"></span><span id="ref-templates-builtins-tags"></span><h2>Acuan etiket siap-pakai<a class="headerlink" href="#built-in-tag-reference" title="Link permanen untuk headline ini">¶</a></h2>
<div class="section" id="s-autoescape">
<span id="s-std:templatetag-autoescape"></span><span id="autoescape"></span><span id="std:templatetag-autoescape"></span><h3><code class="docutils literal notranslate"><span class="pre">autoescape</span></code><a class="headerlink" href="#autoescape" title="Link permanen untuk headline ini">¶</a></h3>
<p>Controls the current auto-escaping behavior. This tag takes either <code class="docutils literal notranslate"><span class="pre">on</span></code> or
<code class="docutils literal notranslate"><span class="pre">off</span></code> as an argument and that determines whether auto-escaping is in effect
inside the block. The block is closed with an <code class="docutils literal notranslate"><span class="pre">endautoescape</span></code> ending tag.</p>
<p>When auto-escaping is in effect, all variable content has HTML escaping applied
to it before placing the result into the output (but after any filters have
been applied). This is equivalent to manually applying the <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a>
filter to each variable.</p>
<p>The only exceptions are variables that are already marked as &quot;safe&quot; from
escaping, either by the code that populated the variable, or because it has had
the <a class="reference internal" href="#std:templatefilter-safe"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">safe</span></code></a> or <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a> filters applied.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">autoescape</span> <span class="nv">on</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">body</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-block">
<span id="s-std:templatetag-block"></span><span id="block"></span><span id="std:templatetag-block"></span><h3><code class="docutils literal notranslate"><span class="pre">block</span></code><a class="headerlink" href="#block" title="Link permanen untuk headline ini">¶</a></h3>
<p>Defines a block that can be overridden by child templates. See
<a class="reference internal" href="language.html#template-inheritance"><span class="std std-ref">Template inheritance</span></a> for more information.</p>
</div>
<div class="section" id="s-comment">
<span id="s-std:templatetag-comment"></span><span id="comment"></span><span id="std:templatetag-comment"></span><h3><code class="docutils literal notranslate"><span class="pre">comment</span></code><a class="headerlink" href="#comment" title="Link permanen untuk headline ini">¶</a></h3>
<p>Ignores everything between <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">comment</span> <span class="pre">%}</span></code> and <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">endcomment</span> <span class="pre">%}</span></code>.
An optional note may be inserted in the first tag. For example, this is
useful when commenting out code for documenting why the code was disabled.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Rendered text with <span class="cp">{{</span> <span class="nv">pub_date</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;c&quot;</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">comment</span> <span class="s2">&quot;Optional note&quot;</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Commented out text with <span class="cp">{{</span> <span class="nv">create_date</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;c&quot;</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endcomment</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Etiket <code class="docutils literal notranslate"><span class="pre">comment</span></code> tidak dapat bersarang.</p>
</div>
<div class="section" id="s-csrf-token">
<span id="s-std:templatetag-csrf_token"></span><span id="csrf-token"></span><span id="std:templatetag-csrf_token"></span><h3><code class="docutils literal notranslate"><span class="pre">csrf_token</span></code><a class="headerlink" href="#csrf-token" title="Link permanen untuk headline ini">¶</a></h3>
<p>This tag is used for CSRF protection, as described in the documentation for
<a class="reference internal" href="../csrf.html"><span class="doc">Cross Site Request Forgeries</span></a>.</p>
</div>
<div class="section" id="s-cycle">
<span id="s-std:templatetag-cycle"></span><span id="cycle"></span><span id="std:templatetag-cycle"></span><h3><code class="docutils literal notranslate"><span class="pre">cycle</span></code><a class="headerlink" href="#cycle" title="Link permanen untuk headline ini">¶</a></h3>
<p>Produces one of its arguments each time this tag is encountered. The first
argument is produced on the first encounter, the second argument on the second
encounter, and so forth. Once all arguments are exhausted, the tag cycles to
the first argument and produces it again.</p>
<p>Etiket ini khususnya berguna dalam lingkaran:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">o</span> <span class="k">in</span> <span class="nv">some_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">tr</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="s1">&#39;row2&#39;</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
        ...
    <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Perulangan pertama menghasilkan HTML yang mengacu pada kelas <code class="docutils literal notranslate"><span class="pre">row1</span></code>, kedua pada <code class="docutils literal notranslate"><span class="pre">row2</span></code>, ketiga pada <code class="docutils literal notranslate"><span class="pre">row1</span></code> kembali, dan seterusnya untuk setiap perulangan dari putaran.</p>
<p>You can use variables, too. For example, if you have two template variables,
<code class="docutils literal notranslate"><span class="pre">rowvalue1</span></code> and <code class="docutils literal notranslate"><span class="pre">rowvalue2</span></code>, you can alternate between their values like
this:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">o</span> <span class="k">in</span> <span class="nv">some_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">tr</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="nv">rowvalue1</span> <span class="nv">rowvalue2</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
        ...
    <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Variabel-variabel disertakan dalam siklus akan diloloskan. Anda dapat meniadakan pelolosan-otomatis:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">o</span> <span class="k">in</span> <span class="nv">some_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">tr</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">autoescape</span> <span class="nv">off</span> <span class="cp">%}{%</span> <span class="k">cycle</span> <span class="nv">rowvalue1</span> <span class="nv">rowvalue2</span> <span class="cp">%}{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
        ...
    <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Anda dapat mencampur variabel dan string:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">o</span> <span class="k">in</span> <span class="nv">some_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">tr</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="nv">rowvalue2</span> <span class="s1">&#39;row3&#39;</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
        ...
    <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>In some cases you might want to refer to the current value of a cycle
without advancing to the next value. To do this,
just give the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> tag a name, using &quot;as&quot;, like this:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="s1">&#39;row2&#39;</span> <span class="k">as</span> <span class="nv">rowcolors</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>From then on, you can insert the current value of the cycle wherever you'd like
in your template by referencing the cycle name as a context variable. If you
want to move the cycle to the next value independently of the original
<code class="docutils literal notranslate"><span class="pre">cycle</span></code> tag, you can use another <code class="docutils literal notranslate"><span class="pre">cycle</span></code> tag and specify the name of the
variable. So, the following template:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="s1">&#39;row2&#39;</span> <span class="k">as</span> <span class="nv">rowcolors</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">rowcolors</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="nv">rowcolors</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">rowcolors</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>akan mengeluarkan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;row1&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;row1&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;row2&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">td</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;row2&quot;</span><span class="p">&gt;</span>...<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>You can use any number of values in a <code class="docutils literal notranslate"><span class="pre">cycle</span></code> tag, separated by spaces.
Values enclosed in single quotes (<code class="docutils literal notranslate"><span class="pre">'</span></code>) or double quotes (<code class="docutils literal notranslate"><span class="pre">&quot;</span></code>) are treated
as string literals, while values without quotes are treated as template
variables.</p>
<p>By default, when you use the <code class="docutils literal notranslate"><span class="pre">as</span></code> keyword with the cycle tag, the
usage of <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> that initiates the cycle will itself produce
the first value in the cycle. This could be a problem if you want to
use the value in a nested loop or an included template. If you only want
to declare the cycle but not produce the first value, you can add a
<code class="docutils literal notranslate"><span class="pre">silent</span></code> keyword as the last keyword in the tag. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">obj</span> <span class="k">in</span> <span class="nv">some_list</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="s1">&#39;row2&#39;</span> <span class="k">as</span> <span class="nv">rowcolors</span> <span class="nv">silent</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">tr</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">rowcolors</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{%</span> <span class="k">include</span> <span class="s2">&quot;subtemplate.html&quot;</span> <span class="cp">%}</span><span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>This will output a list of <code class="docutils literal notranslate"><span class="pre">&lt;tr&gt;</span></code> elements with <code class="docutils literal notranslate"><span class="pre">class</span></code>
alternating between <code class="docutils literal notranslate"><span class="pre">row1</span></code> and <code class="docutils literal notranslate"><span class="pre">row2</span></code>. The subtemplate will have
access to <code class="docutils literal notranslate"><span class="pre">rowcolors</span></code> in its context and the value will match the class
of the <code class="docutils literal notranslate"><span class="pre">&lt;tr&gt;</span></code> that encloses it. If the <code class="docutils literal notranslate"><span class="pre">silent</span></code> keyword were to be
omitted, <code class="docutils literal notranslate"><span class="pre">row1</span></code> and <code class="docutils literal notranslate"><span class="pre">row2</span></code> would be emitted as normal text, outside the
<code class="docutils literal notranslate"><span class="pre">&lt;tr&gt;</span></code> element.</p>
<p>When the silent keyword is used on a cycle definition, the silence
automatically applies to all subsequent uses of that specific cycle tag.
The following template would output <em>nothing</em>, even though the second
call to <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> doesn't specify <code class="docutils literal notranslate"><span class="pre">silent</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;row1&#39;</span> <span class="s1">&#39;row2&#39;</span> <span class="k">as</span> <span class="nv">rowcolors</span> <span class="nv">silent</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">cycle</span> <span class="nv">rowcolors</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Anda dapat menggunakan etiket <a class="reference internal" href="#std:templatetag-resetcycle"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">resetcycle</span></code></a> untuk membuat sebuah etiket <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> mulai ulang dari nilai pertamanya ketika itu selanjutnya ditemui.</p>
</div>
<div class="section" id="s-debug">
<span id="s-std:templatetag-debug"></span><span id="debug"></span><span id="std:templatetag-debug"></span><h3><code class="docutils literal notranslate"><span class="pre">debug</span></code><a class="headerlink" href="#debug" title="Link permanen untuk headline ini">¶</a></h3>
<p>Outputs a whole load of debugging information, including the current context
and imported modules.</p>
</div>
<div class="section" id="s-extends">
<span id="s-std:templatetag-extends"></span><span id="extends"></span><span id="std:templatetag-extends"></span><h3><code class="docutils literal notranslate"><span class="pre">extends</span></code><a class="headerlink" href="#extends" title="Link permanen untuk headline ini">¶</a></h3>
<p>Sinyal-sinyal yang cetakan ini memperpanjang cetakan induk.</p>
<p>Etiket ini dapat digunakan dalam dua cara:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">extends</span> <span class="pre">&quot;base.html&quot;</span> <span class="pre">%}</span></code> (with quotes) uses the literal value
<code class="docutils literal notranslate"><span class="pre">&quot;base.html&quot;</span></code> as the name of the parent template to extend.</li>
<li><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">extends</span> <span class="pre">variable</span> <span class="pre">%}</span></code> uses the value of <code class="docutils literal notranslate"><span class="pre">variable</span></code>. If the variable
evaluates to a string, Django will use that string as the name of the
parent template. If the variable evaluates to a <code class="docutils literal notranslate"><span class="pre">Template</span></code> object,
Django will use that object as the parent template.</li>
</ul>
<p>Lihat <a class="reference internal" href="language.html#template-inheritance"><span class="std std-ref">Template inheritance</span></a> untuk informasi lebih.</p>
<p>Normally the template name is relative to the template loader's root directory.
A string argument may also be a relative path starting with <code class="docutils literal notranslate"><span class="pre">./</span></code> or <code class="docutils literal notranslate"><span class="pre">../</span></code>.
For example, assume the following directory structure:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>dir1/
    template.html
    base2.html
    my/
        base3.html
base1.html
</pre></div>
</div>
<p>Dalam <code class="docutils literal notranslate"><span class="pre">template.html</span></code>, jalur berikut akan sah:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;./base2.html&quot;</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;../base1.html&quot;</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">extends</span> <span class="s2">&quot;./my/base3.html&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-filter">
<span id="s-std:templatetag-filter"></span><span id="filter"></span><span id="std:templatetag-filter"></span><h3><code class="docutils literal notranslate"><span class="pre">filter</span></code><a class="headerlink" href="#filter" title="Link permanen untuk headline ini">¶</a></h3>
<p>Filters the contents of the block through one or more filters. Multiple
filters can be specified with pipes and filters can have arguments, just as
in variable syntax.</p>
<p>Catat bahwa blok menyertakan <em>semua</em> teks diantara etiket <code class="docutils literal notranslate"><span class="pre">filter</span></code> dan <code class="docutils literal notranslate"><span class="pre">endfilter</span></code>.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">filter</span> <span class="nf">force_escape</span><span class="o">|</span><span class="nf">lower</span> <span class="cp">%}</span>
    This text will be HTML-escaped, and will appear in all lowercase.
<span class="cp">{%</span> <span class="k">endfilter</span> <span class="cp">%}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p class="last">The <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a> and <a class="reference internal" href="#std:templatefilter-safe"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">safe</span></code></a> filters are not acceptable
arguments. Instead, use the <a class="reference internal" href="#std:templatetag-autoescape"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">autoescape</span></code></a> tag to manage autoescaping
for blocks of template code.</p>
</div>
</div>
<div class="section" id="s-firstof">
<span id="s-std:templatetag-firstof"></span><span id="firstof"></span><span id="std:templatetag-firstof"></span><h3><code class="docutils literal notranslate"><span class="pre">firstof</span></code><a class="headerlink" href="#firstof" title="Link permanen untuk headline ini">¶</a></h3>
<p>Outputs the first argument variable that is not <code class="docutils literal notranslate"><span class="pre">False</span></code>. Outputs nothing if
all the passed variables are <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">firstof</span> <span class="nv">var1</span> <span class="nv">var2</span> <span class="nv">var3</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Ini adalah setara pada:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">var1</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">var1</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">elif</span> <span class="nv">var2</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">var2</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">elif</span> <span class="nv">var3</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">var3</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>You can also use a literal string as a fallback value in case all
passed variables are False:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">firstof</span> <span class="nv">var1</span> <span class="nv">var2</span> <span class="nv">var3</span> <span class="s2">&quot;fallback value&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>This tag auto-escapes variable values. You can disable auto-escaping with:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">autoescape</span> <span class="nv">off</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">firstof</span> <span class="nv">var1</span> <span class="nv">var2</span> <span class="nv">var3</span> <span class="s2">&quot;&lt;strong&gt;fallback value&lt;/strong&gt;&quot;</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Atau jika hanya beberapa variabel harus diloloskan, anda dapat menggunakan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">firstof</span> <span class="nv">var1</span> <span class="nv">var2</span><span class="o">|</span><span class="nf">safe</span> <span class="nv">var3</span> <span class="s2">&quot;&lt;strong&gt;fallback value&lt;/strong&gt;&quot;</span><span class="o">|</span><span class="nf">safe</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>You can use the syntax <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">firstof</span> <span class="pre">var1</span> <span class="pre">var2</span> <span class="pre">var3</span> <span class="pre">as</span> <span class="pre">value</span> <span class="pre">%}</span></code> to store the
output inside a variable.</p>
</div>
<div class="section" id="s-for">
<span id="s-std:templatetag-for"></span><span id="for"></span><span id="std:templatetag-for"></span><h3><code class="docutils literal notranslate"><span class="pre">for</span></code><a class="headerlink" href="#for" title="Link permanen untuk headline ini">¶</a></h3>
<p>Loops over each item in an array, making the item available in a context
variable. For example, to display a list of athletes provided in
<code class="docutils literal notranslate"><span class="pre">athlete_list</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">athlete</span> <span class="k">in</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">athlete.name</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Anda dapat memutar kembali daftar dalam kebalikan dengan menggunakan <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">for</span> <span class="pre">obj</span> <span class="pre">in</span> <span class="pre">list</span> <span class="pre">reversed</span> <span class="pre">%}</span></code>.</p>
<p>If you need to loop over a list of lists, you can unpack the values
in each sublist into individual variables. For example, if your context
contains a list of (x,y) coordinates called <code class="docutils literal notranslate"><span class="pre">points</span></code>, you could use the
following to output the list of points:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">x</span><span class="o">,</span> <span class="nv">y</span> <span class="k">in</span> <span class="nv">points</span> <span class="cp">%}</span>
    There is a point at <span class="cp">{{</span> <span class="nv">x</span> <span class="cp">}}</span>,<span class="cp">{{</span> <span class="nv">y</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>This can also be useful if you need to access the items in a dictionary.
For example, if your context contained a dictionary <code class="docutils literal notranslate"><span class="pre">data</span></code>, the following
would display the keys and values of the dictionary:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">key</span><span class="o">,</span> <span class="nv">value</span> <span class="k">in</span> <span class="nv">data.items</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">key</span> <span class="cp">}}</span>: <span class="cp">{{</span> <span class="nv">value</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Keep in mind that for the dot operator, dictionary key lookup takes precedence
over method lookup. Therefore if the <code class="docutils literal notranslate"><span class="pre">data</span></code> dictionary contains a key named
<code class="docutils literal notranslate"><span class="pre">'items'</span></code>, <code class="docutils literal notranslate"><span class="pre">data.items</span></code> will return <code class="docutils literal notranslate"><span class="pre">data['items']</span></code> instead of
<code class="docutils literal notranslate"><span class="pre">data.items()</span></code>. Avoid adding keys that are named like dictionary methods if
you want to use those methods in a template (<code class="docutils literal notranslate"><span class="pre">items</span></code>, <code class="docutils literal notranslate"><span class="pre">values</span></code>, <code class="docutils literal notranslate"><span class="pre">keys</span></code>,
etc.). Read more about the lookup order of the dot operator in the
<a class="reference internal" href="language.html#template-variables"><span class="std std-ref">documentation of template variables</span></a>.</p>
<p>Putaran for mensetel angka dari variabel-variabel tersedia dalam putaran.</p>
<table class="docutils">
<colgroup>
<col width="36%" />
<col width="64%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Variabel</th>
<th class="head">Deskripsi</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">forloop.counter</span></code></td>
<td>Perulangan saat ini dari putaran (indeks-1)</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">forloop.counter0</span></code></td>
<td>Perulangan saat ini dari putaran (indeks-0)</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">forloop.revcounter</span></code></td>
<td>Jumlah perulangan dari akhir dari putaran (indeks-1)</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">forloop.revcounter0</span></code></td>
<td>Jumlah perulangan dari akhir dari perputaran (indeks-0)</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">forloop.first</span></code></td>
<td>True jika ini adalah waktu pertama melalui perulangan</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">forloop.last</span></code></td>
<td>True jika ini adalah waktu terakhir melalui perulangan</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">forloop.parentloop</span></code></td>
<td>Untuk perulangan bersarang, ini adalah perulangan disekitar satu saat ini</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="s-for-empty">
<span id="for-empty"></span><h3><code class="docutils literal notranslate"><span class="pre">for</span></code> ... <code class="docutils literal notranslate"><span class="pre">empty</span></code><a class="headerlink" href="#for-empty" title="Link permanen untuk headline ini">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">for</span></code> tag can take an optional <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">empty</span> <span class="pre">%}</span></code> clause whose text is
displayed if the given array is empty or could not be found:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">athlete</span> <span class="k">in</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">athlete.name</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">empty</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Sorry, no athletes in this list.<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Diatas setara pada -- tetapi lebih pendek, lebih bersih, dan kemungkinan lebih cepat dari -- berikut:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
  <span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">athlete</span> <span class="k">in</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
      <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">athlete.name</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
    <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
  <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Sorry, no athletes in this list.<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
  <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-if">
<span id="s-std:templatetag-if"></span><span id="if"></span><span id="std:templatetag-if"></span><h3><code class="docutils literal notranslate"><span class="pre">if</span></code><a class="headerlink" href="#if" title="Link permanen untuk headline ini">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">if</span> <span class="pre">%}</span></code> tag evaluates a variable, and if that variable is &quot;true&quot; (i.e.
exists, is not empty, and is not a false boolean value) the contents of the
block are output:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
    Number of athletes: <span class="cp">{{</span> <span class="nv">athlete_list</span><span class="o">|</span><span class="nf">length</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">elif</span> <span class="nv">athlete_in_locker_room_list</span> <span class="cp">%}</span>
    Athletes should be out of the locker room soon!
<span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
    No athletes.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>In the above, if <code class="docutils literal notranslate"><span class="pre">athlete_list</span></code> is not empty, the number of athletes will be
displayed by the <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">athlete_list|length</span> <span class="pre">}}</span></code> variable.</p>
<p>As you can see, the <code class="docutils literal notranslate"><span class="pre">if</span></code> tag may take one or several <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">elif</span> <span class="pre">%}</span></code>
clauses, as well as an <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">else</span> <span class="pre">%}</span></code> clause that will be displayed if all
previous conditions fail. These clauses are optional.</p>
<div class="section" id="s-boolean-operators">
<span id="boolean-operators"></span><h4>Penghubung Boolean<a class="headerlink" href="#boolean-operators" title="Link permanen untuk headline ini">¶</a></h4>
<p>Etiket <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> tags may use <code class="docutils literal notranslate"><span class="pre">and</span></code>, <code class="docutils literal notranslate"><span class="pre">or</span></code> or <code class="docutils literal notranslate"><span class="pre">not</span></code> to test a number of variables mungkin menggunakan <code class="docutils literal notranslate"><span class="pre">and</span></code>, <code class="docutils literal notranslate"><span class="pre">or</span></code> atau <code class="docutils literal notranslate"><span class="pre">not</span></code> untuk mencoba sejumlah variabel atau meniadakan variabel yang diberikan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="k">and</span> <span class="nv">coach_list</span> <span class="cp">%}</span>
    Both athletes and coaches are available.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="k">not</span> <span class="nv">athlete_list</span> <span class="cp">%}</span>
    There are no athletes.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="k">or</span> <span class="nv">coach_list</span> <span class="cp">%}</span>
    There are some athletes or some coaches.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="k">not</span> <span class="nv">athlete_list</span> <span class="k">or</span> <span class="nv">coach_list</span> <span class="cp">%}</span>
    There are no athletes or there are some coaches.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="k">and</span> <span class="k">not</span> <span class="nv">coach_list</span> <span class="cp">%}</span>
    There are some athletes and absolutely no coaches.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Use of both <code class="docutils literal notranslate"><span class="pre">and</span></code> and <code class="docutils literal notranslate"><span class="pre">or</span></code> clauses within the same tag is allowed, with
<code class="docutils literal notranslate"><span class="pre">and</span></code> having higher precedence than <code class="docutils literal notranslate"><span class="pre">or</span></code> e.g.:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">athlete_list</span> <span class="k">and</span> <span class="nv">coach_list</span> <span class="k">or</span> <span class="nv">cheerleader_list</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>akan diartikan seperti:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="n">athlete_list</span> <span class="ow">and</span> <span class="n">coach_list</span><span class="p">)</span> <span class="ow">or</span> <span class="n">cheerleader_list</span>
</pre></div>
</div>
<p>Use of actual parentheses in the <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> tag is invalid syntax. If you need
them to indicate precedence, you should use nested <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> tags.</p>
<p><a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> etiket mungkin juga menggunakan penghubung <code class="docutils literal notranslate"><span class="pre">==</span></code>, <code class="docutils literal notranslate"><span class="pre">!=</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;=</span></code>, <code class="docutils literal notranslate"><span class="pre">&gt;=</span></code>, <code class="docutils literal notranslate"><span class="pre">in</span></code>, <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">in</span></code>, <code class="docutils literal notranslate"><span class="pre">is</span></code>, dan <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code> yang bekerja sebagai berikut:</p>
<div class="section" id="s-operator">
<span id="operator"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">==</span></code><a class="headerlink" href="#operator" title="Link permanen untuk headline ini">¶</a></h5>
<p>Sama dengan. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">==</span> <span class="s2">&quot;x&quot;</span> <span class="cp">%}</span>
  This appears if variable somevar equals the string &quot;x&quot;
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id1">
<span id="id1"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">!=</span></code><a class="headerlink" href="#id1" title="Link permanen untuk headline ini">¶</a></h5>
<p>Tidak sama dengan. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">!=</span> <span class="s2">&quot;x&quot;</span> <span class="cp">%}</span>
  This appears if variable somevar does not equal the string &quot;x&quot;,
  or if somevar is not found in the context
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id2">
<span id="id2"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">&lt;</span></code><a class="headerlink" href="#id2" title="Link permanen untuk headline ini">¶</a></h5>
<p>Kurang dari. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">&lt;</span> <span class="m">100</span> <span class="cp">%}</span>
  This appears if variable somevar is less than 100.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id3">
<span id="id3"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">&gt;</span></code><a class="headerlink" href="#id3" title="Link permanen untuk headline ini">¶</a></h5>
<p>Lebih besar dari. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">&gt;</span> <span class="m">0</span> <span class="cp">%}</span>
  This appears if variable somevar is greater than 0.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id4">
<span id="id4"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">&lt;=</span></code><a class="headerlink" href="#id4" title="Link permanen untuk headline ini">¶</a></h5>
<p>Kurang dari atau sama dengan. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">&lt;=</span> <span class="m">100</span> <span class="cp">%}</span>
  This appears if variable somevar is less than 100 or equal to 100.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-id5">
<span id="id5"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">&gt;=</span></code><a class="headerlink" href="#id5" title="Link permanen untuk headline ini">¶</a></h5>
<p>Lebih besar atau sama dengan. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="o">&gt;=</span> <span class="m">1</span> <span class="cp">%}</span>
  This appears if variable somevar is greater than 1 or equal to 1.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-in-operator">
<span id="in-operator"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">in</span></code><a class="headerlink" href="#in-operator" title="Link permanen untuk headline ini">¶</a></h5>
<p>Contained within. This operator is supported by many Python containers to test
whether the given value is in the container. The following are some examples
of how <code class="docutils literal notranslate"><span class="pre">x</span> <span class="pre">in</span> <span class="pre">y</span></code> will be interpreted:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="s2">&quot;bc&quot;</span> <span class="k">in</span> <span class="s2">&quot;abcdef&quot;</span> <span class="cp">%}</span>
  This appears since &quot;bc&quot; is a substring of &quot;abcdef&quot;
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="s2">&quot;hello&quot;</span> <span class="k">in</span> <span class="nv">greetings</span> <span class="cp">%}</span>
  If greetings is a list or set, one element of which is the string
  &quot;hello&quot;, this will appear.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="nv">user</span> <span class="k">in</span> <span class="nv">users</span> <span class="cp">%}</span>
  If users is a QuerySet, this will appear if user is an
  instance that belongs to the QuerySet.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-not-in-operator">
<span id="not-in-operator"></span><h5>Penghubung <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">in</span></code><a class="headerlink" href="#not-in-operator" title="Link permanen untuk headline ini">¶</a></h5>
<p>Tidak terkandung dalam. Ini adalah lawan dari penghubung <code class="docutils literal notranslate"><span class="pre">in</span></code>.</p>
</div>
<div class="section" id="s-is-operator">
<span id="is-operator"></span><h5>penghubung <code class="docutils literal notranslate"><span class="pre">is</span></code><a class="headerlink" href="#is-operator" title="Link permanen untuk headline ini">¶</a></h5>
<p>Pencirian obyek. Coba jika dua nilai adalah obyek sama. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="k">is</span> <span class="nf">True</span> <span class="cp">%}</span>
  This appears if and only if somevar is True.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="k">is</span> <span class="nf">None</span> <span class="cp">%}</span>
  This appears if somevar is None, or if somevar is not found in the context.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-is-not-operator">
<span id="is-not-operator"></span><h5>penghubung <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code><a class="headerlink" href="#is-not-operator" title="Link permanen untuk headline ini">¶</a></h5>
<p>Ditiadakan penciri obyek. Percobaan jika dua nilai bukan obyek sama. Ini adalah meniadakan dari penghubung <code class="docutils literal notranslate"><span class="pre">is</span></code>. Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="k">is</span> <span class="k">not</span> <span class="nf">True</span> <span class="cp">%}</span>
  This appears if somevar is not True, or if somevar is not found in the
  context.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>

<span class="cp">{%</span> <span class="k">if</span> <span class="nv">somevar</span> <span class="k">is</span> <span class="k">not</span> <span class="nf">None</span> <span class="cp">%}</span>
  This appears if and only if somevar is not None.
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="s-filters">
<span id="filters"></span><h4>Filter<a class="headerlink" href="#filters" title="Link permanen untuk headline ini">¶</a></h4>
<p>Anda dapat juga menggunakan penyaring dalam pernyataan <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a>. Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">messages</span><span class="o">|</span><span class="nf">length</span> <span class="o">&gt;=</span> <span class="m">100</span> <span class="cp">%}</span>
   You have lots of messages today!
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-complex-expressions">
<span id="complex-expressions"></span><h4>Pernyataan rumit<a class="headerlink" href="#complex-expressions" title="Link permanen untuk headline ini">¶</a></h4>
<p>All of the above can be combined to form complex expressions. For such
expressions, it can be important to know how the operators are grouped when the
expression is evaluated - that is, the precedence rules. The precedence of the
operators, from lowest to highest, is as follows:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">or</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">and</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">not</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">in</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">==</span></code>, <code class="docutils literal notranslate"><span class="pre">!=</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;=</span></code>, <code class="docutils literal notranslate"><span class="pre">&gt;=</span></code></li>
</ul>
<p>(Ini mengikuti Python tepatnya). Jadi, sebagai contoh, etiket <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> rumit berikut:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">a</span> <span class="o">==</span> <span class="nv">b</span> <span class="k">or</span> <span class="nv">c</span> <span class="o">==</span> <span class="nv">d</span> <span class="k">and</span> <span class="nv">e</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>...akan diartikan sebagai:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="n">b</span><span class="p">)</span> <span class="ow">or</span> <span class="p">((</span><span class="n">c</span> <span class="o">==</span> <span class="n">d</span><span class="p">)</span> <span class="ow">and</span> <span class="n">e</span><span class="p">)</span>
</pre></div>
</div>
<p>If you need different precedence, you will need to use nested <a class="reference internal" href="#std:templatetag-if"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">if</span></code></a> tags.
Sometimes that is better for clarity anyway, for the sake of those who do not
know the precedence rules.</p>
<p>The comparison operators cannot be 'chained' like in Python or in mathematical
notation. For example, instead of using:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">a</span> <span class="o">&gt;</span> <span class="nv">b</span> <span class="o">&gt;</span> <span class="nv">c</span> <span class="cp">%}</span>  (WRONG)
</pre></div>
</div>
<p>anda harus menggunakan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">a</span> <span class="o">&gt;</span> <span class="nv">b</span> <span class="k">and</span> <span class="nv">b</span> <span class="o">&gt;</span> <span class="nv">c</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="s-ifequal-and-ifnotequal">
<span id="ifequal-and-ifnotequal"></span><h3><code class="docutils literal notranslate"><span class="pre">ifequal</span></code> dan <code class="docutils literal notranslate"><span class="pre">ifnotequal</span></code><a class="headerlink" href="#ifequal-and-ifnotequal" title="Link permanen untuk headline ini">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">ifequal</span> <span class="pre">a</span> <span class="pre">b</span> <span class="pre">%}</span> <span class="pre">...</span> <span class="pre">{%</span> <span class="pre">endifequal</span> <span class="pre">%}</span></code> adalah cara mutlak menulis <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">if</span> <span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span> <span class="pre">%}</span> <span class="pre">...</span> <span class="pre">{%</span> <span class="pre">endif</span> <span class="pre">%}</span></code>. Juga, <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">ifnotequal</span> <span class="pre">a</span> <span class="pre">b</span> <span class="pre">%}</span> <span class="pre">...</span> <span class="pre">{%</span> <span class="pre">endifnotequal</span> <span class="pre">%}</span></code> digantikan oleh <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">if</span> <span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span> <span class="pre">%}</span> <span class="pre">...</span> <span class="pre">{%</span> <span class="pre">endif</span> <span class="pre">%}</span></code>. Etiket <code class="docutils literal notranslate"><span class="pre">ifequal</span></code> dan <code class="docutils literal notranslate"><span class="pre">ifnotequal</span></code> akan diusangkan dalam terbitan mendatang.</p>
</div>
<div class="section" id="s-ifchanged">
<span id="s-std:templatetag-ifchanged"></span><span id="ifchanged"></span><span id="std:templatetag-ifchanged"></span><h3><code class="docutils literal notranslate"><span class="pre">ifchanged</span></code><a class="headerlink" href="#ifchanged" title="Link permanen untuk headline ini">¶</a></h3>
<p>Periksa jika nilai telah berubah dari putaran terakhir dari perulangan.</p>
<p>Etiket blok <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">ifchanged</span> <span class="pre">%}</span></code> digunakan dalam perulangan. Itu mempunyai dua kemungkinan penggunaan.</p>
<ol class="arabic">
<li><p class="first">Checks its own rendered contents against its previous state and only
displays the content if it has changed. For example, this displays a list of
days, only displaying the month if it changes:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>Archive for <span class="cp">{{</span> <span class="nv">year</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>

<span class="cp">{%</span> <span class="k">for</span> <span class="nv">date</span> <span class="k">in</span> <span class="nv">days</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">ifchanged</span> <span class="cp">%}</span><span class="p">&lt;</span><span class="nt">h3</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">date</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;F&quot;</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h3</span><span class="p">&gt;</span><span class="cp">{%</span> <span class="k">endifchanged</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">date</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;M/d&quot;</span><span class="o">|</span><span class="nf">lower</span> <span class="cp">}}</span><span class="s">/&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">date</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;j&quot;</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
</li>
<li><p class="first">If given one or more variables, check whether any variable has changed.
For example, the following shows the date every time it changes, while
showing the hour if either the hour or the date has changed:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">date</span> <span class="k">in</span> <span class="nv">days</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">ifchanged</span> <span class="nv">date.date</span> <span class="cp">%}</span> <span class="cp">{{</span> <span class="nv">date.date</span> <span class="cp">}}</span> <span class="cp">{%</span> <span class="k">endifchanged</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">ifchanged</span> <span class="nv">date.hour</span> <span class="nv">date.date</span> <span class="cp">%}</span>
        <span class="cp">{{</span> <span class="nv">date.hour</span> <span class="cp">}}</span>
    <span class="cp">{%</span> <span class="k">endifchanged</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
</li>
</ol>
<p>The <code class="docutils literal notranslate"><span class="pre">ifchanged</span></code> tag can also take an optional <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">else</span> <span class="pre">%}</span></code> clause that
will be displayed if the value has not changed:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">match</span> <span class="k">in</span> <span class="nv">matches</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;background-color:</span>
<span class="s">        </span><span class="cp">{%</span> <span class="k">ifchanged</span> <span class="nv">match.ballot_id</span> <span class="cp">%}</span><span class="s"></span>
<span class="s">            </span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s2">&quot;red&quot;</span> <span class="s2">&quot;blue&quot;</span> <span class="cp">%}</span><span class="s"></span>
<span class="s">        </span><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span><span class="s"></span>
<span class="s">            gray</span>
<span class="s">        </span><span class="cp">{%</span> <span class="k">endifchanged</span> <span class="cp">%}</span><span class="s"></span>
<span class="s">    &quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">match</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-include">
<span id="s-std:templatetag-include"></span><span id="include"></span><span id="std:templatetag-include"></span><h3><code class="docutils literal notranslate"><span class="pre">include</span></code><a class="headerlink" href="#include" title="Link permanen untuk headline ini">¶</a></h3>
<p>Loads a template and renders it with the current context. This is a way of
&quot;including&quot; other templates within a template.</p>
<p>The template name can either be a variable or a hard-coded (quoted) string,
in either single or double quotes.</p>
<p>Contoh ini menyertakan isi dari cetakan <code class="docutils literal notranslate"><span class="pre">&quot;foo/bar.html&quot;</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">include</span> <span class="s2">&quot;foo/bar.html&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Normally the template name is relative to the template loader's root directory.
A string argument may also be a relative path starting with <code class="docutils literal notranslate"><span class="pre">./</span></code> or <code class="docutils literal notranslate"><span class="pre">../</span></code>
as described in the <a class="reference internal" href="#std:templatetag-extends"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">extends</span></code></a> tag.</p>
<p>Contoh ini menyertakan isi dari cetakan yang namanya dikandung dalam variabel <code class="docutils literal notranslate"><span class="pre">template_name</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">include</span> <span class="nv">template_name</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>The variable may also be any object with a <code class="docutils literal notranslate"><span class="pre">render()</span></code> method that accepts a
context. This allows you to reference a compiled <code class="docutils literal notranslate"><span class="pre">Template</span></code> in your context.</p>
<p>An included template is rendered within the context of the template that
includes it. This example produces the output <code class="docutils literal notranslate"><span class="pre">&quot;Hello,</span> <span class="pre">John!&quot;</span></code>:</p>
<ul>
<li><p class="first">Konteks: variabel <code class="docutils literal notranslate"><span class="pre">person``disetel</span> <span class="pre">menjadi</span> <span class="pre">``&quot;John&quot;</span></code> dan variabel <code class="docutils literal notranslate"><span class="pre">greeting</span></code> disetel menjadi <code class="docutils literal notranslate"><span class="pre">&quot;Hello&quot;</span></code>.</p>
</li>
<li><p class="first">Cetakan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">include</span> <span class="s2">&quot;name_snippet.html&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
</li>
<li><p class="first">Cetakan <code class="docutils literal notranslate"><span class="pre">name_snippet.html</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">greeting</span> <span class="cp">}}</span>, <span class="cp">{{</span> <span class="nv">person</span><span class="o">|</span><span class="nf">default</span><span class="s2">:&quot;friend&quot;</span> <span class="cp">}}</span>!
</pre></div>
</div>
</li>
</ul>
<p>Anda dapat melewatkan konteks tambahan pada cetakan menggunakan argumen-argumen kata kunci:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">include</span> <span class="s2">&quot;name_snippet.html&quot;</span> <span class="k">with</span> <span class="nv">person</span><span class="o">=</span><span class="s2">&quot;Jane&quot;</span> <span class="nv">greeting</span><span class="o">=</span><span class="s2">&quot;Hello&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>If you want to render the context only with the variables provided (or even
no variables at all), use the <code class="docutils literal notranslate"><span class="pre">only</span></code> option. No other variables are
available to the included template:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">include</span> <span class="s2">&quot;name_snippet.html&quot;</span> <span class="k">with</span> <span class="nv">greeting</span><span class="o">=</span><span class="s2">&quot;Hi&quot;</span> <span class="nv">only</span> <span class="cp">%}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p>The <a class="reference internal" href="#std:templatetag-include"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">include</span></code></a> tag should be considered as an implementation of
&quot;render this subtemplate and include the HTML&quot;, not as &quot;parse this
subtemplate and include its contents as if it were part of the parent&quot;.
This means that there is no shared state between included templates --
each include is a completely independent rendering process.</p>
<p class="last">Blocks are evaluated <em>before</em> they are included. This means that a template
that includes blocks from another will contain blocks that have <em>already
been evaluated and rendered</em> - not blocks that can be overridden by, for
example, an extending template.</p>
</div>
</div>
<div class="section" id="s-load">
<span id="s-std:templatetag-load"></span><span id="load"></span><span id="std:templatetag-load"></span><h3><code class="docutils literal notranslate"><span class="pre">load</span></code><a class="headerlink" href="#load" title="Link permanen untuk headline ini">¶</a></h3>
<p>Memuat kumpulan etiket cetakan penyesuaian.</p>
<p>For example, the following template would load all the tags and filters
registered in <code class="docutils literal notranslate"><span class="pre">somelibrary</span></code> and <code class="docutils literal notranslate"><span class="pre">otherlibrary</span></code> located in package
<code class="docutils literal notranslate"><span class="pre">package</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">somelibrary</span> <span class="nv">package.otherlibrary</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>You can also selectively load individual filters or tags from a library, using
the <code class="docutils literal notranslate"><span class="pre">from</span></code> argument. In this example, the template tags/filters named <code class="docutils literal notranslate"><span class="pre">foo</span></code>
and <code class="docutils literal notranslate"><span class="pre">bar</span></code> will be loaded from <code class="docutils literal notranslate"><span class="pre">somelibrary</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">foo</span> <span class="nv">bar</span> <span class="nv">from</span> <span class="nv">somelibrary</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Lihat <a class="reference internal" href="../../howto/custom-template-tags.html"><span class="doc">Custom tag and filter libraries</span></a> untuk informasi lebih.</p>
</div>
<div class="section" id="s-lorem">
<span id="s-std:templatetag-lorem"></span><span id="lorem"></span><span id="std:templatetag-lorem"></span><h3><code class="docutils literal notranslate"><span class="pre">lorem</span></code><a class="headerlink" href="#lorem" title="Link permanen untuk headline ini">¶</a></h3>
<p>Menampilkan teks latin &quot;lorem ipsum&quot; acak. Ini berguna untuk menyediakan contoh data dalam cetakan.</p>
<p>Penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">lorem</span> <span class="o">[</span><span class="nv">count</span><span class="o">]</span> <span class="o">[</span><span class="nv">method</span><span class="o">]</span> <span class="o">[</span><span class="nv">random</span><span class="o">]</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Etiket <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">%}</span></code> dapat digunakan dengan nol, satu, dua atau tiga argumen. Argumennya adalah:</p>
<table class="docutils">
<colgroup>
<col width="15%" />
<col width="85%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Argument</th>
<th class="head">Deskripsi</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">count</span></code></td>
<td>Sejumlah (atau variabel) mengandung sejumlah paragraf atau kata-kata untuk membangkitkan (awalan adalah 1).</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">method</span></code></td>
<td>Antara <code class="docutils literal notranslate"><span class="pre">w</span></code> untuk kata-kata, <code class="docutils literal notranslate"><span class="pre">p</span></code> untuk paragraf HTML atau <code class="docutils literal notranslate"><span class="pre">b</span></code> untuk blok-blok paragraf teks-polos (awalan <code class="docutils literal notranslate"><span class="pre">b</span></code>).</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">random</span></code></td>
<td>Kata <code class="docutils literal notranslate"><span class="pre">random</span></code>, yang jika diberikan, tiadk menggunakan paragraf umum (&quot;Lorem ipsum dolor sit amet...&quot;)&nbsp;ketika membangkitkan teks.</td>
</tr>
</tbody>
</table>
<p>Contoh:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">%}</span></code> akan mengeluarkan paragraf umum &quot;lorem ipsum&quot;.</li>
<li><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">3</span> <span class="pre">p</span> <span class="pre">%}</span></code> akan mengeluarkan paragraf umum &quot;lorem ipsum&quot; dan dua paragraf acak masing-masing dibungkus daam etiket HTML <code class="docutils literal notranslate"><span class="pre">&lt;p&gt;</span></code>.</li>
<li><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">2</span> <span class="pre">w</span> <span class="pre">random</span> <span class="pre">%}</span></code> akan mengeluarkan dua kata Latin acak.</li>
</ul>
</div>
<div class="section" id="s-now">
<span id="s-std:templatetag-now"></span><span id="now"></span><span id="std:templatetag-now"></span><h3><code class="docutils literal notranslate"><span class="pre">now</span></code><a class="headerlink" href="#now" title="Link permanen untuk headline ini">¶</a></h3>
<p>Displays the current date and/or time, using a format according to the given
string. Such string can contain format specifiers characters as described
in the <a class="reference internal" href="#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> filter section.</p>
<p>Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>It is <span class="cp">{%</span> <span class="k">now</span> <span class="s2">&quot;jS F Y H:i&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Catat bahwa anda dapat meloloskan-garis-miring-terbalik sebuah bentuk string jika anda ingin menggunakan nilai &quot;mentah&quot;. Dalam contoh ini, kedua &quot;o&quot; dan &quot;f&quot; adalah meloloskan-garis-miring-terbalik, karena sebaliknya setiapnya adalah bentuk string yang menampilkan tahun dan waktu, masing-masing:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>It is the <span class="cp">{%</span> <span class="k">now</span> <span class="s2">&quot;jS \o\f F&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Ini akan ditampilkan sebagai &quot;It is the 4th of September&quot;.</p>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p>The format passed can also be one of the predefined ones
<a class="reference internal" href="../settings.html#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a>, <a class="reference internal" href="../settings.html#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>,
<a class="reference internal" href="../settings.html#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a> or <a class="reference internal" href="../settings.html#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a>.
The predefined formats may vary depending on the current locale and
if <a class="reference internal" href="../../topics/i18n/formatting.html"><span class="doc">Format localization</span></a> is enabled, e.g.:</p>
<div class="last highlight-html+django notranslate"><div class="highlight"><pre><span></span>It is <span class="cp">{%</span> <span class="k">now</span> <span class="s2">&quot;SHORT_DATETIME_FORMAT&quot;</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<p>You can also use the syntax <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">now</span> <span class="pre">&quot;Y&quot;</span> <span class="pre">as</span> <span class="pre">current_year</span> <span class="pre">%}</span></code> to store the
output (as a string) inside a variable. This is useful if you want to use
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">now</span> <span class="pre">%}</span></code> inside a template tag like <a class="reference internal" href="../../topics/i18n/translation.html#std:templatetag-blocktrans"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">blocktrans</span></code></a> for example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">now</span> <span class="s2">&quot;Y&quot;</span> <span class="k">as</span> <span class="nv">current_year</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">blocktrans</span> <span class="cp">%}</span>Copyright <span class="cp">{{</span> <span class="nv">current_year</span> <span class="cp">}}{%</span> <span class="k">endblocktrans</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-regroup">
<span id="s-std:templatetag-regroup"></span><span id="regroup"></span><span id="std:templatetag-regroup"></span><h3><code class="docutils literal notranslate"><span class="pre">regroup</span></code><a class="headerlink" href="#regroup" title="Link permanen untuk headline ini">¶</a></h3>
<p>Regroups a list of alike objects by a common attribute.</p>
<p>This complex tag is best illustrated by way of an example: say that <code class="docutils literal notranslate"><span class="pre">cities</span></code>
is a list of cities represented by dictionaries containing <code class="docutils literal notranslate"><span class="pre">&quot;name&quot;</span></code>,
<code class="docutils literal notranslate"><span class="pre">&quot;population&quot;</span></code>, and <code class="docutils literal notranslate"><span class="pre">&quot;country&quot;</span></code> keys:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cities</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Mumbai&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;19,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;India&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Calcutta&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;15,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;India&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;New York&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;20,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;USA&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Chicago&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;7,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;USA&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Tokyo&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;33,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;Japan&#39;</span><span class="p">},</span>
<span class="p">]</span>
</pre></div>
</div>
<p>...dan anda ingin menampilkan daftar susunan bertingkat yang diurutkan berdasarkan negara, seperti ini:</p>
<ul class="simple">
<li>India<ul>
<li>Mumbai: 19,000,000</li>
<li>Calcutta: 15,000,000</li>
</ul>
</li>
<li>USA<ul>
<li>New York: 20,000,000</li>
<li>Chicago: 7,000,000</li>
</ul>
</li>
<li>Jepang<ul>
<li>Tokyo: 33,000,000</li>
</ul>
</li>
</ul>
<p>You can use the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> tag to group the list of cities by country.
The following snippet of template code would accomplish this:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">regroup</span> <span class="nv">cities</span> <span class="nv">by</span> <span class="nv">country</span> <span class="k">as</span> <span class="nv">country_list</span> <span class="cp">%}</span>

<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">country</span> <span class="k">in</span> <span class="nv">country_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">country.grouper</span> <span class="cp">}}</span>
    <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
        <span class="cp">{%</span> <span class="k">for</span> <span class="nv">city</span> <span class="k">in</span> <span class="nv">country.list</span> <span class="cp">%}</span>
          <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">city.name</span> <span class="cp">}}</span>: <span class="cp">{{</span> <span class="nv">city.population</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
        <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
    <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Let's walk through this example. <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> takes three arguments: the
list you want to regroup, the attribute to group by, and the name of the
resulting list. Here, we're regrouping the <code class="docutils literal notranslate"><span class="pre">cities</span></code> list by the <code class="docutils literal notranslate"><span class="pre">country</span></code>
attribute and calling the result <code class="docutils literal notranslate"><span class="pre">country_list</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> produces a list (in this case, <code class="docutils literal notranslate"><span class="pre">country_list</span></code>) of
<strong>group objects</strong>. Group objects are instances of
<a class="reference external" href="https://docs.python.org/3/library/collections.html#collections.namedtuple" title="(di Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a> with two fields:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">grouper</span></code> -- brang dikelompokkan berdasarkan (misalnya, string &quot;India&quot; atau &quot;Japan&quot;).</li>
<li><code class="docutils literal notranslate"><span class="pre">list</span></code> -- sebuah daftar dari semua barang dalam kelompok ini (misalnya, sebuah daftar dari semua kota dengan negara='India').</li>
</ul>
<p>Karena <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> menghasilkan obyek-obyek <a class="reference external" href="https://docs.python.org/3/library/collections.html#collections.namedtuple" title="(di Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a>, anda dapat juga menulis contoh sebelumnya sebagai:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">regroup</span> <span class="nv">cities</span> <span class="nv">by</span> <span class="nv">country</span> <span class="k">as</span> <span class="nv">country_list</span> <span class="cp">%}</span>

<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">country</span><span class="o">,</span> <span class="nv">local_cities</span> <span class="k">in</span> <span class="nv">country_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">country</span> <span class="cp">}}</span>
    <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
        <span class="cp">{%</span> <span class="k">for</span> <span class="nv">city</span> <span class="k">in</span> <span class="nv">local_cities</span> <span class="cp">%}</span>
          <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">city.name</span> <span class="cp">}}</span>: <span class="cp">{{</span> <span class="nv">city.population</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
        <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
    <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Note that <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> does not order its input! Our example relies on
the fact that the <code class="docutils literal notranslate"><span class="pre">cities</span></code> list was ordered by <code class="docutils literal notranslate"><span class="pre">country</span></code> in the first place.
If the <code class="docutils literal notranslate"><span class="pre">cities</span></code> list did <em>not</em> order its members by <code class="docutils literal notranslate"><span class="pre">country</span></code>, the
regrouping would naively display more than one group for a single country. For
example, say the <code class="docutils literal notranslate"><span class="pre">cities</span></code> list was set to this (note that the countries are not
grouped together):</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cities</span> <span class="o">=</span> <span class="p">[</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Mumbai&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;19,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;India&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;New York&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;20,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;USA&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Calcutta&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;15,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;India&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Chicago&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;7,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;USA&#39;</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Tokyo&#39;</span><span class="p">,</span> <span class="s1">&#39;population&#39;</span><span class="p">:</span> <span class="s1">&#39;33,000,000&#39;</span><span class="p">,</span> <span class="s1">&#39;country&#39;</span><span class="p">:</span> <span class="s1">&#39;Japan&#39;</span><span class="p">},</span>
<span class="p">]</span>
</pre></div>
</div>
<p>Dengan masukan ini untuk <code class="docutils literal notranslate"><span class="pre">cities</span></code>, contoh kode cetakan <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">regroup</span> <span class="pre">%}</span></code> diatas akan menghasilkan keluaran berikut:</p>
<ul class="simple">
<li>India<ul>
<li>Mumbai: 19,000,000</li>
</ul>
</li>
<li>USA<ul>
<li>New York: 20,000,000</li>
</ul>
</li>
<li>India<ul>
<li>Calcutta: 15,000,000</li>
</ul>
</li>
<li>USA<ul>
<li>Chicago: 7,000,000</li>
</ul>
</li>
<li>Jepang<ul>
<li>Tokyo: 33,000,000</li>
</ul>
</li>
</ul>
<p>The easiest solution to this gotcha is to make sure in your view code that the
data is ordered according to how you want to display it.</p>
<p>Another solution is to sort the data in the template using the
<a class="reference internal" href="#std:templatefilter-dictsort"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">dictsort</span></code></a> filter, if your data is in a list of dictionaries:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">regroup</span> <span class="nv">cities</span><span class="o">|</span><span class="nf">dictsort</span><span class="s2">:&quot;country&quot;</span> <span class="nv">by</span> <span class="nv">country</span> <span class="k">as</span> <span class="nv">country_list</span> <span class="cp">%}</span>
</pre></div>
</div>
<div class="section" id="s-grouping-on-other-properties">
<span id="grouping-on-other-properties"></span><h4>Mengkelompokkan pada sifat lain<a class="headerlink" href="#grouping-on-other-properties" title="Link permanen untuk headline ini">¶</a></h4>
<p>Any valid template lookup is a legal grouping attribute for the regroup
tag, including methods, attributes, dictionary keys and list items. For
example, if the &quot;country&quot; field is a foreign key to a class with
an attribute &quot;description,&quot; you could use:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">regroup</span> <span class="nv">cities</span> <span class="nv">by</span> <span class="nv">country.description</span> <span class="k">as</span> <span class="nv">country_list</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Atau, jika <code class="docutils literal notranslate"><span class="pre">country</span></code> adalah sebuah bidang dengan <code class="docutils literal notranslate"><span class="pre">choices</span></code>, itu akan memiliki metode <a class="reference internal" href="../models/instances.html#django.db.models.Model.get_FOO_display" title="django.db.models.Model.get_FOO_display"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_FOO_display()</span></code></a> tersedia sebagai sebuah atribut, mengizinkan anda mengelompokkan pada tampilan string daripada kunci <code class="docutils literal notranslate"><span class="pre">choices</span></code>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">regroup</span> <span class="nv">cities</span> <span class="nv">by</span> <span class="nv">get_country_display</span> <span class="k">as</span> <span class="nv">country_list</span> <span class="cp">%}</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">country.grouper</span> <span class="pre">}}</span></code> sekarang akan menampilan nilai bidang dari <code class="docutils literal notranslate"><span class="pre">choices</span></code> disetel daripada kunci.</p>
</div>
</div>
<div class="section" id="s-resetcycle">
<span id="s-std:templatetag-resetcycle"></span><span id="resetcycle"></span><span id="std:templatetag-resetcycle"></span><h3><code class="docutils literal notranslate"><span class="pre">resetcycle</span></code><a class="headerlink" href="#resetcycle" title="Link permanen untuk headline ini">¶</a></h3>
<p>Resets a previous <a class="reference internal" href="#cycle">cycle</a> so that it restarts from its first item at its next
encounter. Without arguments, <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">resetcycle</span> <span class="pre">%}</span></code> will reset the last
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">cycle</span> <span class="pre">%}</span></code> defined in the template.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">coach</span> <span class="k">in</span> <span class="nv">coach_list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">coach.name</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">athlete</span> <span class="k">in</span> <span class="nv">coach.athlete_set.all</span> <span class="cp">%}</span>
        <span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;odd&#39;</span> <span class="s1">&#39;even&#39;</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">athlete.name</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
    <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">resetcycle</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Contoh ini akan mengembalikan HTML ini:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>José Mourinho<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;odd&quot;</span><span class="p">&gt;</span>Thibaut Courtois<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;even&quot;</span><span class="p">&gt;</span>John Terry<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;odd&quot;</span><span class="p">&gt;</span>Eden Hazard<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>Carlo Ancelotti<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;odd&quot;</span><span class="p">&gt;</span>Manuel Neuer<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;even&quot;</span><span class="p">&gt;</span>Thomas Müller<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Notice how the first block ends with <code class="docutils literal notranslate"><span class="pre">class=&quot;odd&quot;</span></code> and the new one starts
with <code class="docutils literal notranslate"><span class="pre">class=&quot;odd&quot;</span></code>. Without the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">resetcycle</span> <span class="pre">%}</span></code> tag, the second block
would start with <code class="docutils literal notranslate"><span class="pre">class=&quot;even&quot;</span></code>.</p>
<p>Anda dapat mensetel kembali etiket siklus nama:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">list</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;odd&#39;</span> <span class="s1">&#39;even&#39;</span> <span class="k">as</span> <span class="nv">stripe</span> <span class="cp">%}</span><span class="s"> </span><span class="cp">{%</span> <span class="k">cycle</span> <span class="s1">&#39;major&#39;</span> <span class="s1">&#39;minor&#39;</span> <span class="s1">&#39;minor&#39;</span> <span class="s1">&#39;minor&#39;</span> <span class="s1">&#39;minor&#39;</span> <span class="k">as</span> <span class="nv">tick</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
        <span class="cp">{{</span> <span class="nv">item.data</span> <span class="cp">}}</span>
    <span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
    <span class="cp">{%</span> <span class="k">ifchanged</span> <span class="nv">item.category</span> <span class="cp">%}</span>
        <span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">item.category</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
        <span class="cp">{%</span> <span class="k">if</span> <span class="k">not</span> <span class="nb">forloop</span><span class="nv">.first</span> <span class="cp">%}{%</span> <span class="k">resetcycle</span> <span class="nv">tick</span> <span class="cp">%}{%</span> <span class="k">endif</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">endifchanged</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>In this example, we have both the alternating odd/even rows and a &quot;major&quot; row
every fifth row. Only the five-row cycle is reset when a category changes.</p>
</div>
<div class="section" id="s-spaceless">
<span id="s-std:templatetag-spaceless"></span><span id="spaceless"></span><span id="std:templatetag-spaceless"></span><h3><code class="docutils literal notranslate"><span class="pre">spaceless</span></code><a class="headerlink" href="#spaceless" title="Link permanen untuk headline ini">¶</a></h3>
<p>Memindahkan ruang kosong diantara etiket HTML. Ini menyertakan karakter tab dan baris baru.</p>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">spaceless</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;foo/&quot;</span><span class="p">&gt;</span>Foo<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endspaceless</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Contoh ini akan mengembalikan HTML ini:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;foo/&quot;</span><span class="p">&gt;</span>Foo<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Only space between <em>tags</em> is removed -- not space between tags and text. In
this example, the space around <code class="docutils literal notranslate"><span class="pre">Hello</span></code> won't be stripped:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">spaceless</span> <span class="cp">%}</span>
    <span class="p">&lt;</span><span class="nt">strong</span><span class="p">&gt;</span>
        Hello
    <span class="p">&lt;/</span><span class="nt">strong</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endspaceless</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-templatetag">
<span id="s-std:templatetag-templatetag"></span><span id="templatetag"></span><span id="std:templatetag-templatetag"></span><h3><code class="docutils literal notranslate"><span class="pre">templatetag</span></code><a class="headerlink" href="#templatetag" title="Link permanen untuk headline ini">¶</a></h3>
<p>Outputs one of the syntax characters used to compose template tags.</p>
<p>Since the template system has no concept of &quot;escaping&quot;, to display one of the
bits used in template tags, you must use the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">templatetag</span> <span class="pre">%}</span></code> tag.</p>
<p>Argumen akan memberitahu bit cetakan mana akan keluar:</p>
<table class="docutils">
<colgroup>
<col width="72%" />
<col width="28%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Argument</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">openblock</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{%</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">closeblock</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">%}</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">openvariable</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">closevariable</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">}}</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">openbrace</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">closebrace</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">}</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">opencomment</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{#</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">closecomment</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">#}</span></code></td>
</tr>
</tbody>
</table>
<p>Contoh penggunaan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">templatetag</span> <span class="nv">openblock</span> <span class="cp">%}</span> url &#39;entry_list&#39; <span class="cp">{%</span> <span class="k">templatetag</span> <span class="nv">closeblock</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-url">
<span id="s-std:templatetag-url"></span><span id="url"></span><span id="std:templatetag-url"></span><h3><code class="docutils literal notranslate"><span class="pre">url</span></code><a class="headerlink" href="#url" title="Link permanen untuk headline ini">¶</a></h3>
<p>Returns an absolute path reference (a URL without the domain name) matching a
given view and optional parameters. Any special characters in the resulting
path will be encoded using <a class="reference internal" href="../utils.html#django.utils.encoding.iri_to_uri" title="django.utils.encoding.iri_to_uri"><code class="xref py py-func docutils literal notranslate"><span class="pre">iri_to_uri()</span></code></a>.</p>
<p>This is a way to output links without violating the DRY principle by having to
hard-code URLs in your templates:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;some-url-name&#39;</span> <span class="nv">v1</span> <span class="nv">v2</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>The first argument is a <a class="reference internal" href="../../topics/http/urls.html#naming-url-patterns"><span class="std std-ref">URL pattern name</span></a>. It can
be a quoted literal or any other context variable. Additional arguments are
optional and should be space-separated values that will be used as arguments in
the URL. The example above shows passing positional arguments. Alternatively
you may use keyword syntax:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;some-url-name&#39;</span> <span class="nv">arg1</span><span class="o">=</span><span class="nv">v1</span> <span class="nv">arg2</span><span class="o">=</span><span class="nv">v2</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Do not mix both positional and keyword syntax in a single call. All arguments
required by the URLconf should be present.</p>
<p>For example, suppose you have a view, <code class="docutils literal notranslate"><span class="pre">app_views.client</span></code>, whose URLconf
takes a client ID (here, <code class="docutils literal notranslate"><span class="pre">client()</span></code> is a method inside the views file
<code class="docutils literal notranslate"><span class="pre">app_views.py</span></code>). The URLconf line might look like this:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">path</span><span class="p">(</span><span class="s1">&#39;client/&lt;int:id&gt;/&#39;</span><span class="p">,</span> <span class="n">app_views</span><span class="o">.</span><span class="n">client</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;app-views-client&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>If this app's URLconf is included into the project's URLconf under a path
such as this:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">path</span><span class="p">(</span><span class="s1">&#39;clients/&#39;</span><span class="p">,</span> <span class="n">include</span><span class="p">(</span><span class="s1">&#39;project_name.app_name.urls&#39;</span><span class="p">))</span>
</pre></div>
</div>
<p>...kemudian, dalam cetakan, anda dapat membuat sebuah tautan ke tampilan seperti ini:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;app-views-client&#39;</span> <span class="nv">client.id</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Etiket cetakan akan mengeluarkan deretan karakter <code class="docutils literal notranslate"><span class="pre">/clients/client/123/</span></code>.</p>
<p>Note that if the URL you're reversing doesn't exist, you'll get an
<a class="reference internal" href="../exceptions.html#django.urls.NoReverseMatch" title="django.urls.NoReverseMatch"><code class="xref py py-exc docutils literal notranslate"><span class="pre">NoReverseMatch</span></code></a> exception raised, which will cause your
site to display an error page.</p>
<p>If you'd like to retrieve a URL without displaying it, you can use a slightly
different call:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;some-url-name&#39;</span> <span class="nv">arg</span> <span class="nv">arg2</span> <span class="k">as</span> <span class="nv">the_url</span> <span class="cp">%}</span>

<span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">the_url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>I&#39;m linking to <span class="cp">{{</span> <span class="nv">the_url</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>The scope of the variable created by the  <code class="docutils literal notranslate"><span class="pre">as</span> <span class="pre">var</span></code> syntax is the
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">block</span> <span class="pre">%}</span></code> in which the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">url</span> <span class="pre">%}</span></code> tag appears.</p>
<p>This <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">url</span> <span class="pre">...</span> <span class="pre">as</span> <span class="pre">var</span> <span class="pre">%}</span></code> syntax will <em>not</em> cause an error if the view is
missing. In practice you'll use this to link to views that are optional:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;some-url-name&#39;</span> <span class="k">as</span> <span class="nv">the_url</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">if</span> <span class="nv">the_url</span> <span class="cp">%}</span>
  <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">the_url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>Link to optional stuff<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>If you'd like to retrieve a namespaced URL, specify the fully qualified name:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">url</span> <span class="s1">&#39;myapp:view-name&#39;</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>This will follow the normal <a class="reference internal" href="../../topics/http/urls.html#topics-http-reversing-url-namespaces"><span class="std std-ref">namespaced URL resolution strategy</span></a>, including using any hints provided
by the context as to the current application.</p>
<div class="admonition warning">
<p class="first admonition-title">Peringatan</p>
<p class="last">Don't forget to put quotes around the URL pattern <code class="docutils literal notranslate"><span class="pre">name</span></code>, otherwise the
value will be interpreted as a context variable!</p>
</div>
</div>
<div class="section" id="s-verbatim">
<span id="s-std:templatetag-verbatim"></span><span id="verbatim"></span><span id="std:templatetag-verbatim"></span><h3><code class="docutils literal notranslate"><span class="pre">verbatim</span></code><a class="headerlink" href="#verbatim" title="Link permanen untuk headline ini">¶</a></h3>
<p>Stops the template engine from rendering the contents of this block tag.</p>
<p>A common use is to allow a JavaScript template layer that collides with
Django's syntax. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">verbatim</span> <span class="cp">%}</span>
    <span class="cp">{{</span><span class="k">if</span> <span class="nv">dying</span><span class="cp">}}</span>Still alive.<span class="cp">{{</span><span class="o">/</span><span class="k">if</span><span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endverbatim</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>You can also designate a specific closing tag, allowing the use of
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">endverbatim</span> <span class="pre">%}</span></code> as part of the unrendered contents:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">verbatim</span> <span class="nv">myblock</span> <span class="cp">%}</span>
    Avoid template rendering via the <span class="cp">{%</span> <span class="k">verbatim</span> <span class="cp">%}{%</span> <span class="k">endverbatim</span> <span class="cp">%}</span> block.
<span class="cp">{%</span> <span class="k">endverbatim</span> <span class="nv">myblock</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-widthratio">
<span id="s-std:templatetag-widthratio"></span><span id="widthratio"></span><span id="std:templatetag-widthratio"></span><h3><code class="docutils literal notranslate"><span class="pre">widthratio</span></code><a class="headerlink" href="#widthratio" title="Link permanen untuk headline ini">¶</a></h3>
<p>For creating bar charts and such, this tag calculates the ratio of a given
value to a maximum value, and then applies that ratio to a constant.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;bar.png&quot;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&quot;Bar&quot;</span>
     <span class="na">height</span><span class="o">=</span><span class="s">&quot;10&quot;</span> <span class="na">width</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">widthratio</span> <span class="nv">this_value</span> <span class="nv">max_value</span> <span class="nv">max_width</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">this_value</span></code> is 175, <code class="docutils literal notranslate"><span class="pre">max_value</span></code> is 200, and <code class="docutils literal notranslate"><span class="pre">max_width</span></code> is 100, the
image in the above example will be 88 pixels wide
(because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88).</p>
<p>In some cases you might want to capture the result of <code class="docutils literal notranslate"><span class="pre">widthratio</span></code> in a
variable. It can be useful, for instance, in a <a class="reference internal" href="../../topics/i18n/translation.html#std:templatetag-blocktrans"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">blocktrans</span></code></a> like this:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">widthratio</span> <span class="nv">this_value</span> <span class="nv">max_value</span> <span class="nv">max_width</span> <span class="k">as</span> <span class="nv">width</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">blocktrans</span> <span class="cp">%}</span>The width is: <span class="cp">{{</span> <span class="nv">width</span> <span class="cp">}}{%</span> <span class="k">endblocktrans</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-with">
<span id="s-std:templatetag-with"></span><span id="with"></span><span id="std:templatetag-with"></span><h3><code class="docutils literal notranslate"><span class="pre">with</span></code><a class="headerlink" href="#with" title="Link permanen untuk headline ini">¶</a></h3>
<p>Caches a complex variable under a simpler name. This is useful when accessing
an &quot;expensive&quot; method (e.g., one that hits the database) multiple times.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">with</span> <span class="nv">total</span><span class="o">=</span><span class="nv">business.employees.count</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">total</span> <span class="cp">}}</span> employee<span class="cp">{{</span> <span class="nv">total</span><span class="o">|</span><span class="nf">pluralize</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endwith</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>The populated variable (in the example above, <code class="docutils literal notranslate"><span class="pre">total</span></code>) is only available
between the <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">with</span> <span class="pre">%}</span></code> and <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">endwith</span> <span class="pre">%}</span></code> tags.</p>
<p>Anda dapat memberikan lebih dari satu variabel konteks:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">with</span> <span class="nv">alpha</span><span class="o">=</span><span class="m">1</span> <span class="nv">beta</span><span class="o">=</span><span class="m">2</span> <span class="cp">%}</span>
    ...
<span class="cp">{%</span> <span class="k">endwith</span> <span class="cp">%}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p class="last">The previous more verbose format is still supported:
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">with</span> <span class="pre">business.employees.count</span> <span class="pre">as</span> <span class="pre">total</span> <span class="pre">%}</span></code></p>
</div>
</div>
</div>
<div class="section" id="s-built-in-filter-reference">
<span id="s-ref-templates-builtins-filters"></span><span id="built-in-filter-reference"></span><span id="ref-templates-builtins-filters"></span><h2>Petunjuk penyaring siap-pakai<a class="headerlink" href="#built-in-filter-reference" title="Link permanen untuk headline ini">¶</a></h2>
<div class="section" id="s-add">
<span id="s-std:templatefilter-add"></span><span id="add"></span><span id="std:templatefilter-add"></span><h3><code class="docutils literal notranslate"><span class="pre">add</span></code><a class="headerlink" href="#add" title="Link permanen untuk headline ini">¶</a></h3>
<p>Tambah argumen ke nilai.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">add</span><span class="s2">:&quot;2&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">4</span></code>, kemudian keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">6</span></code>.</p>
<p>This filter will first try to coerce both values to integers. If this fails,
it'll attempt to add the values together anyway. This will work on some data
types (strings, list, etc.) and fail on others. If it fails, the result will
be an empty string.</p>
<p>Sebagai contoh, jika kami mempunyai:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">first</span><span class="o">|</span><span class="nf">add</span><span class="o">:</span><span class="nv">second</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>dan <code class="docutils literal notranslate"><span class="pre">first</span></code> adalah <code class="docutils literal notranslate"><span class="pre">[1,</span> <span class="pre">2,</span> <span class="pre">3]</span></code> dan <code class="docutils literal notranslate"><span class="pre">second</span></code> adalah <code class="docutils literal notranslate"><span class="pre">[4,</span> <span class="pre">5,</span> <span class="pre">6]</span></code>, kemudian keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">[1,</span> <span class="pre">2,</span> <span class="pre">3,</span> <span class="pre">4,</span> <span class="pre">5,</span> <span class="pre">6]</span></code>.</p>
<div class="admonition warning">
<p class="first admonition-title">Peringatan</p>
<p class="last">Strings that can be coerced to integers will be <strong>summed</strong>, not
concatenated, as in the first example above.</p>
</div>
</div>
<div class="section" id="s-addslashes">
<span id="s-std:templatefilter-addslashes"></span><span id="addslashes"></span><span id="std:templatefilter-addslashes"></span><h3><code class="docutils literal notranslate"><span class="pre">addslashes</span></code><a class="headerlink" href="#addslashes" title="Link permanen untuk headline ini">¶</a></h3>
<p>Tambah garis miring sebelum kutipan. Berguna untuk pelolosan string dalam CSV, sebagai contoh.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">addslashes</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;I'm</span> <span class="pre">using</span> <span class="pre">Django&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;I\'m</span> <span class="pre">using</span> <span class="pre">Django&quot;</span></code>.</p>
</div>
<div class="section" id="s-capfirst">
<span id="s-std:templatefilter-capfirst"></span><span id="capfirst"></span><span id="std:templatefilter-capfirst"></span><h3><code class="docutils literal notranslate"><span class="pre">capfirst</span></code><a class="headerlink" href="#capfirst" title="Link permanen untuk headline ini">¶</a></h3>
<p>Capitalizes the first character of the value. If the first character is not
a letter, this filter has no effect.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">capfirst</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;django&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">&quot;Django&quot;</span></code>.</p>
</div>
<div class="section" id="s-center">
<span id="s-std:templatefilter-center"></span><span id="center"></span><span id="std:templatefilter-center"></span><h3><code class="docutils literal notranslate"><span class="pre">center</span></code><a class="headerlink" href="#center" title="Link permanen untuk headline ini">¶</a></h3>
<p>Tengahkan nilai di bidang dari lebar yang diberikan.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>&quot;<span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">center</span><span class="s2">:&quot;15&quot;</span> <span class="cp">}}</span>&quot;
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;Django&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">&quot;</span> <span class="pre">Django</span> <span class="pre">&quot;</span></code>.</p>
</div>
<div class="section" id="s-cut">
<span id="s-std:templatefilter-cut"></span><span id="cut"></span><span id="std:templatefilter-cut"></span><h3><code class="docutils literal notranslate"><span class="pre">cut</span></code><a class="headerlink" href="#cut" title="Link permanen untuk headline ini">¶</a></h3>
<p>Memindahkan semua nilai dari arg dari string yang diberikan.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">cut</span><span class="s2">:&quot; &quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;String</span> <span class="pre">with</span> <span class="pre">spaces&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;Stringwithspaces&quot;</span></code>.</p>
</div>
<div class="section" id="s-date">
<span id="s-std:templatefilter-date"></span><span id="date"></span><span id="std:templatefilter-date"></span><h3><code class="docutils literal notranslate"><span class="pre">date</span></code><a class="headerlink" href="#date" title="Link permanen untuk headline ini">¶</a></h3>
<p>Bentuk tanggal menurut pada bentuk yang diberikan.</p>
<p>Menggunakan bentuk yang mirip seperti fungsi <code class="docutils literal notranslate"><span class="pre">date()</span></code>  PHP (<a class="reference external" href="https://php.net/date">https://php.net/date</a>) dengan beberapa perbedaan.</p>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p class="last">These format characters are not used in Django outside of templates. They
were designed to be compatible with PHP to ease transitioning for designers.</p>
</div>
<p id="date-and-time-formatting-specifiers">String bentuk tersedia:</p>
<table class="docutils">
<colgroup>
<col width="12%" />
<col width="31%" />
<col width="57%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Bentuk karakter</th>
<th class="head">Deskripsi</th>
<th class="head">Contoh keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><strong>Hari</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">d</span></code></td>
<td>Hari dari bulan, 2 angka dengan dimulai nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'01'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'31'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">j</span></code></td>
<td>Hari dari bulan tanpa dimulai nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'31'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">D</span></code></td>
<td>Hari dari minggu, tekstual, 3 huruf.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Fri'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">l</span></code></td>
<td>Hari dari minggu, tekstual, panjang.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Jumat'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">S</span></code></td>
<td>English ordinal suffix for day of the
month, 2 characters.</td>
<td><code class="docutils literal notranslate"><span class="pre">'st'</span></code>, <code class="docutils literal notranslate"><span class="pre">'nd'</span></code>, <code class="docutils literal notranslate"><span class="pre">'rd'</span></code> or <code class="docutils literal notranslate"><span class="pre">'th'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">w</span></code></td>
<td>Hari dari minggu, angka tanpa dimulai nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'0'</span></code> (Minggu) sampai <code class="docutils literal notranslate"><span class="pre">'6'</span></code> (Sabtu)</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">z</span></code></td>
<td>Hari dari tahun.</td>
<td><code class="docutils literal notranslate"><span class="pre">1</span></code> to <code class="docutils literal notranslate"><span class="pre">366</span></code></td>
</tr>
<tr class="row-even"><td><strong>Minggu</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">W</span></code></td>
<td>Angka minggu ISO-8601 dari tahun, dengan minggu dimulai pada Senin.</td>
<td><code class="docutils literal notranslate"><span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">53</span></code></td>
</tr>
<tr class="row-even"><td><strong>Bulan</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">m</span></code></td>
<td>Bulan, 2 angka tanpa dimulai nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'01'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'12'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">n</span></code></td>
<td>Bulan tanpa dimulai dengan nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'12'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">M</span></code></td>
<td>Bulan, tektual, 3 huruf.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Jan'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">b</span></code></td>
<td>Bulan, tekstual, 3 huruf, huruf kecil.</td>
<td><code class="docutils literal notranslate"><span class="pre">'jan'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">E</span></code></td>
<td>Month, locale specific alternative
representation usually used for long
date representation.</td>
<td><code class="docutils literal notranslate"><span class="pre">'listopada'</span></code> (untuk lokal Polandia, sebagai lawan terhadap <code class="docutils literal notranslate"><span class="pre">'Listopad'</span></code>)</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">F</span></code></td>
<td>Bulan, tektual, panjang.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Januari'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">N</span></code></td>
<td>Month abbreviation in Associated Press
style. Proprietary extension.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Jan.'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Feb.'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Maret'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Mei'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">t</span></code></td>
<td>Jumlah hari dalam bulan yang diberikan.</td>
<td><code class="docutils literal notranslate"><span class="pre">28</span></code> sampai <code class="docutils literal notranslate"><span class="pre">31</span></code></td>
</tr>
<tr class="row-odd"><td><strong>Tahun</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">y</span></code></td>
<td>Tahun, 2 angka.</td>
<td><code class="docutils literal notranslate"><span class="pre">'99'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">Y</span></code></td>
<td>Tahun, 4 angka.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1999'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">L</span></code></td>
<td>Boolean untuk apakah itu adalah tahun kabisat.</td>
<td><code class="docutils literal notranslate"><span class="pre">True</span></code> atau <code class="docutils literal notranslate"><span class="pre">False</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">o</span></code></td>
<td>ISO-8601 week-numbering year,
corresponding to the ISO-8601 week
number (W) which uses leap weeks. See Y
for the more common year format.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1999'</span></code></td>
</tr>
<tr class="row-even"><td><strong>Waktu</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">g</span></code></td>
<td>Jam, bentuk 12-jam tanpa diawali nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'12'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">G</span></code></td>
<td>Jam, bentuk 24-jam tanpa diawali nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'0'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'23'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">h</span></code></td>
<td>Jam, bentuk 12-jam.</td>
<td><code class="docutils literal notranslate"><span class="pre">'01'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'12'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">H</span></code></td>
<td>Jam, bentuk 24-jam.</td>
<td><code class="docutils literal notranslate"><span class="pre">'00'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'23'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">i</span></code></td>
<td>Menit.</td>
<td><code class="docutils literal notranslate"><span class="pre">'00'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'59'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">s</span></code></td>
<td>Dua, 2 angka dengan awal nol.</td>
<td><code class="docutils literal notranslate"><span class="pre">'00'</span></code> sampai <code class="docutils literal notranslate"><span class="pre">'59'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">u</span></code></td>
<td>Mikrodetik</td>
<td><code class="docutils literal notranslate"><span class="pre">000000</span></code> sampai <code class="docutils literal notranslate"><span class="pre">999999</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">a</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">'a.m.'</span></code> or <code class="docutils literal notranslate"><span class="pre">'p.m.'</span></code> (Note that
this is slightly different than PHP's
output, because this includes periods
to match Associated Press style.)</td>
<td><code class="docutils literal notranslate"><span class="pre">'a.m.'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">A</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">'AM'</span></code> atau <code class="docutils literal notranslate"><span class="pre">'PM'</span></code>.</td>
<td><code class="docutils literal notranslate"><span class="pre">'AM'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">f</span></code></td>
<td>Time, in 12-hour hours and minutes,
with minutes left off if they're zero.
Proprietary extension.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1'</span></code>, <code class="docutils literal notranslate"><span class="pre">'1:30'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">P</span></code></td>
<td>Time, in 12-hour hours, minutes and
'a.m.'/'p.m.', with minutes left off
if they're zero and the special-case
strings 'midnight' and 'noon' if
appropriate. Proprietary extension.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1</span> <span class="pre">a.m.'</span></code>, <code class="docutils literal notranslate"><span class="pre">'1:30</span> <span class="pre">p.m.'</span></code>, <code class="docutils literal notranslate"><span class="pre">'midnight'</span></code>, <code class="docutils literal notranslate"><span class="pre">'noon'</span></code>, <code class="docutils literal notranslate"><span class="pre">'12:30</span> <span class="pre">p.m.'</span></code></td>
</tr>
<tr class="row-even"><td><strong>Zona waktu</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">e</span></code></td>
<td>Timezone name. Could be in any format,
or might return an empty string,
depending on the datetime.</td>
<td><code class="docutils literal notranslate"><span class="pre">''</span></code>, <code class="docutils literal notranslate"><span class="pre">'GMT'</span></code>, <code class="docutils literal notranslate"><span class="pre">'-500'</span></code>, <code class="docutils literal notranslate"><span class="pre">'US/Eastern'</span></code>, etc.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">I</span></code></td>
<td>Daylight Savings Time, apakah itu berpengaruh atau tidak.</td>
<td><code class="docutils literal notranslate"><span class="pre">'1'</span></code> atau <code class="docutils literal notranslate"><span class="pre">'0'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">O</span></code></td>
<td>Perbedaan pada waktu Greenwich dalam jam.</td>
<td><code class="docutils literal notranslate"><span class="pre">'+0200'</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">T</span></code></td>
<td>Zona waktu dari mesin ini.</td>
<td><code class="docutils literal notranslate"><span class="pre">'EST'</span></code>, <code class="docutils literal notranslate"><span class="pre">'MDT'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">Z</span></code></td>
<td>Time zone offset in seconds. The
offset for timezones west of UTC is
always negative, and for those east of
UTC is always positive.</td>
<td><code class="docutils literal notranslate"><span class="pre">-43200</span></code> sampai <code class="docutils literal notranslate"><span class="pre">43200</span></code></td>
</tr>
<tr class="row-even"><td><strong>Tanggal/Waktu</strong></td>
<td>&#160;</td>
<td>&#160;</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">c</span></code></td>
<td>ISO 8601 format. (Note: unlike others
formatters, such as &quot;Z&quot;, &quot;O&quot; or &quot;r&quot;,
the &quot;c&quot; formatter will not add timezone
offset if value is a naive datetime
(see <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.tzinfo" title="(di Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.tzinfo</span></code></a>).</td>
<td><code class="docutils literal notranslate"><span class="pre">2008-01-02T10:30:00.000123+02:00</span></code>, atau <code class="docutils literal notranslate"><span class="pre">2008-01-02T10:30:00.000123</span></code> jika datetime tidak dibuat-buat</td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">r</span></code></td>
<td><span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc5322.html#section-3.3"><strong>RFC 5322</strong></a>
formatted date.</td>
<td><code class="docutils literal notranslate"><span class="pre">'Kam,</span> <span class="pre">21</span> <span class="pre">Des</span> <span class="pre">2000</span> <span class="pre">16:01:07</span> <span class="pre">+0200'</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">U</span></code></td>
<td>Dua sejak Unix Epoch (January 1 1970 00:00:00 UTC).</td>
<td>&#160;</td>
</tr>
</tbody>
</table>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;D d M Y&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">value</span></code> is a <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(di Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime</span></code></a> object (e.g., the result of
<code class="docutils literal notranslate"><span class="pre">datetime.datetime.now()</span></code>), the output will be the string
<code class="docutils literal notranslate"><span class="pre">'Wed</span> <span class="pre">09</span> <span class="pre">Jan</span> <span class="pre">2008'</span></code>.</p>
<p>The format passed can be one of the predefined ones <a class="reference internal" href="../settings.html#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a>,
<a class="reference internal" href="../settings.html#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>, <a class="reference internal" href="../settings.html#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a> or
<a class="reference internal" href="../settings.html#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a>, or a custom format that uses the format
specifiers shown in the table above. Note that predefined formats may vary
depending on the current locale.</p>
<p>Menganggap itu <a class="reference internal" href="../settings.html#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> adalah <code class="docutils literal notranslate"><span class="pre">True</span></code> dan <a class="reference internal" href="../settings.html#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a>, sebagai contoh, <code class="docutils literal notranslate"><span class="pre">&quot;es&quot;</span></code>, kemudian untuk:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;SHORT_DATE_FORMAT&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>the output would be the string <code class="docutils literal notranslate"><span class="pre">&quot;09/01/2008&quot;</span></code> (the <code class="docutils literal notranslate"><span class="pre">&quot;SHORT_DATE_FORMAT&quot;</span></code>
format specifier for the <code class="docutils literal notranslate"><span class="pre">es</span></code> locale as shipped with Django is <code class="docutils literal notranslate"><span class="pre">&quot;d/m/Y&quot;</span></code>).</p>
<p>When used without a format string, the <code class="docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code> format specifier is
used. Assuming the same settings as the previous example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">date</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>outputs <code class="docutils literal notranslate"><span class="pre">9</span> <span class="pre">de</span> <span class="pre">Enero</span> <span class="pre">de</span> <span class="pre">2008</span></code> (the <code class="docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code> format specifier for the
<code class="docutils literal notranslate"><span class="pre">es</span></code> locale is <code class="docutils literal notranslate"><span class="pre">r'j</span> <span class="pre">\d\e</span> <span class="pre">F</span> <span class="pre">\d\e</span> <span class="pre">Y'</span></code>.</p>
<p>You can combine <code class="docutils literal notranslate"><span class="pre">date</span></code> with the <a class="reference internal" href="#std:templatefilter-time"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">time</span></code></a> filter to render a full
representation of a <code class="docutils literal notranslate"><span class="pre">datetime</span></code> value. E.g.:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">date</span><span class="s2">:&quot;D d M Y&quot;</span> <span class="cp">}}</span> <span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">time</span><span class="s2">:&quot;H:i&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-default">
<span id="s-std:templatefilter-default"></span><span id="default"></span><span id="std:templatefilter-default"></span><h3><code class="docutils literal notranslate"><span class="pre">default</span></code><a class="headerlink" href="#default" title="Link permanen untuk headline ini">¶</a></h3>
<p>Jika nilai dinilai ke <code class="docutils literal notranslate"><span class="pre">False</span></code>, gunakan awal yang diberikan. Sebaliknya, gunakan nilai.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">default</span><span class="s2">:&quot;nothing&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code> (string kosong), keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">nothing</span></code>.</p>
</div>
<div class="section" id="s-default-if-none">
<span id="s-std:templatefilter-default_if_none"></span><span id="default-if-none"></span><span id="std:templatefilter-default_if_none"></span><h3><code class="docutils literal notranslate"><span class="pre">default_if_none</span></code><a class="headerlink" href="#default-if-none" title="Link permanen untuk headline ini">¶</a></h3>
<p>Jika (dan hanya jika) nilai adalah <code class="docutils literal notranslate"><span class="pre">None</span></code>, gunakan awal yang diberikan. Sebaliknya, gunakan nilai.</p>
<p>Note that if an empty string is given, the default value will <em>not</em> be used.
Use the <a class="reference internal" href="#std:templatefilter-default"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">default</span></code></a> filter if you want to fallback for empty strings.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">default_if_none</span><span class="s2">:&quot;nothing&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">None</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">nothing</span></code>.</p>
</div>
<div class="section" id="s-dictsort">
<span id="s-std:templatefilter-dictsort"></span><span id="dictsort"></span><span id="std:templatefilter-dictsort"></span><h3><code class="docutils literal notranslate"><span class="pre">dictsort</span></code><a class="headerlink" href="#dictsort" title="Link permanen untuk headline ini">¶</a></h3>
<p>Takes a list of dictionaries and returns that list sorted by the key given in
the argument.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">dictsort</span><span class="s2">:&quot;name&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;zed&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">19</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;amy&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">22</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;joe&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">31</span><span class="p">},</span>
<span class="p">]</span>
</pre></div>
</div>
<p>kemudian keluarannya akan menjadi:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;amy&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">22</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;joe&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">31</span><span class="p">},</span>
    <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;zed&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">19</span><span class="p">},</span>
<span class="p">]</span>
</pre></div>
</div>
<p>Anda dapat juga melakukan hal-hal lebih rumit seperti:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">book</span> <span class="k">in</span> <span class="nv">books</span><span class="o">|</span><span class="nf">dictsort</span><span class="s2">:&quot;author.age&quot;</span> <span class="cp">%}</span>
    * <span class="cp">{{</span> <span class="nv">book.title</span> <span class="cp">}}</span> (<span class="cp">{{</span> <span class="nv">book.author.name</span> <span class="cp">}}</span>)
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">books</span></code> adalah:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">{</span><span class="s1">&#39;title&#39;</span><span class="p">:</span> <span class="s1">&#39;1984&#39;</span><span class="p">,</span> <span class="s1">&#39;author&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;George&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">45</span><span class="p">}},</span>
    <span class="p">{</span><span class="s1">&#39;title&#39;</span><span class="p">:</span> <span class="s1">&#39;Timequake&#39;</span><span class="p">,</span> <span class="s1">&#39;author&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Kurt&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">75</span><span class="p">}},</span>
    <span class="p">{</span><span class="s1">&#39;title&#39;</span><span class="p">:</span> <span class="s1">&#39;Alice&#39;</span><span class="p">,</span> <span class="s1">&#39;author&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Lewis&#39;</span><span class="p">,</span> <span class="s1">&#39;age&#39;</span><span class="p">:</span> <span class="mi">33</span><span class="p">}},</span>
<span class="p">]</span>
</pre></div>
</div>
<p>kemudian keluarannya akan menjadi:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>* Alice (Lewis)
* 1984 (George)
* Timequake (Kurt)
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">dictsort</span></code> can also order a list of lists (or any other object implementing
<code class="docutils literal notranslate"><span class="pre">__getitem__()</span></code>) by elements at specified index. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">dictsort</span><span class="o">:</span><span class="m">0</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s1">&#39;42&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;c&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="s1">&#39;foo&#39;</span><span class="p">),</span>
<span class="p">]</span>
</pre></div>
</div>
<p>kemudian keluarannya akan menjadi:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
    <span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s1">&#39;42&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="s1">&#39;foo&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;c&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
<span class="p">]</span>
</pre></div>
</div>
<p>You must pass the index as an integer rather than a string. The following
produce empty output:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">values</span><span class="o">|</span><span class="nf">dictsort</span><span class="s2">:&quot;0&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-dictsortreversed">
<span id="s-std:templatefilter-dictsortreversed"></span><span id="dictsortreversed"></span><span id="std:templatefilter-dictsortreversed"></span><h3><code class="docutils literal notranslate"><span class="pre">dictsortreversed</span></code><a class="headerlink" href="#dictsortreversed" title="Link permanen untuk headline ini">¶</a></h3>
<p>Takes a list of dictionaries and returns that list sorted in reverse order by
the key given in the argument. This works exactly the same as the above filter,
but the returned value will be in reverse order.</p>
</div>
<div class="section" id="s-divisibleby">
<span id="s-std:templatefilter-divisibleby"></span><span id="divisibleby"></span><span id="std:templatefilter-divisibleby"></span><h3><code class="docutils literal notranslate"><span class="pre">divisibleby</span></code><a class="headerlink" href="#divisibleby" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan <code class="docutils literal notranslate"><span class="pre">True</span></code> jika nilai terbagi oleh argumen.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">divisibleby</span><span class="s2">:&quot;3&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">21</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</div>
<div class="section" id="s-escape">
<span id="s-std:templatefilter-escape"></span><span id="escape"></span><span id="std:templatefilter-escape"></span><h3><code class="docutils literal notranslate"><span class="pre">escape</span></code><a class="headerlink" href="#escape" title="Link permanen untuk headline ini">¶</a></h3>
<p>Meloloskan HTML string. Khususnya, itu membuat pergantian ini:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">&lt;</span></code> dirubah ke <code class="docutils literal notranslate"><span class="pre">&amp;lt;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&gt;</span></code> dirubah ke <code class="docutils literal notranslate"><span class="pre">&amp;gt;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">'</span></code> (kutip tunggal) dirubah ke <code class="docutils literal notranslate"><span class="pre">&amp;#39;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;</span></code> (kutip ganda) dirubah ke <code class="docutils literal notranslate"><span class="pre">&amp;quot;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&amp;</span></code> dirubah ke <code class="docutils literal notranslate"><span class="pre">&amp;amp;</span></code></li>
</ul>
<p>Applying <code class="docutils literal notranslate"><span class="pre">escape</span></code> to a variable that would normally have auto-escaping
applied to the result will only result in one round of escaping being done. So
it is safe to use this function even in auto-escaping environments. If you want
multiple escaping passes to be applied, use the <a class="reference internal" href="#std:templatefilter-force_escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">force_escape</span></code></a> filter.</p>
<p>Sebagai contoh, anda dapat memberlakukan <code class="docutils literal notranslate"><span class="pre">escape</span></code> pada bidang ketika <a class="reference internal" href="#std:templatetag-autoescape"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">autoescape</span></code></a> mati:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">autoescape</span> <span class="nv">off</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">title</span><span class="o">|</span><span class="nf">escape</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-escapejs">
<span id="s-std:templatefilter-escapejs"></span><span id="escapejs"></span><span id="std:templatefilter-escapejs"></span><h3><code class="docutils literal notranslate"><span class="pre">escapejs</span></code><a class="headerlink" href="#escapejs" title="Link permanen untuk headline ini">¶</a></h3>
<p>Escapes characters for use in JavaScript strings. This does <em>not</em> make the
string safe for use in HTML or JavaScript template literals, but does protect
you from syntax errors when using templates to generate JavaScript/JSON.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">escapejs</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;testing\r\njavascript</span> <span class="pre">\'string&quot;</span> <span class="pre">&lt;b&gt;escaping&lt;/b&gt;&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;testing\\u000D\\u000Ajavascript</span> <span class="pre">\\u0027string\\u0022</span> <span class="pre">\\u003Cb\\u003Eescaping\\u003C/b\\u003E&quot;</span></code>.</p>
</div>
<div class="section" id="s-filesizeformat">
<span id="s-std:templatefilter-filesizeformat"></span><span id="filesizeformat"></span><span id="std:templatefilter-filesizeformat"></span><h3><code class="docutils literal notranslate"><span class="pre">filesizeformat</span></code><a class="headerlink" href="#filesizeformat" title="Link permanen untuk headline ini">¶</a></h3>
<p>membentuk nilai seperti ukuran berkas 'dapat-dibaca-manusia' (yaitu <code class="docutils literal notranslate"><span class="pre">'13</span> <span class="pre">KB'</span></code>, <code class="docutils literal notranslate"><span class="pre">'4.1</span> <span class="pre">MB'</span></code>, <code class="docutils literal notranslate"><span class="pre">'102</span> <span class="pre">bytes'</span></code>, dll.).</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">filesizeformat</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah 123456789, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">117.7</span> <span class="pre">MB</span></code>.</p>
<div class="admonition-file-sizes-and-si-units admonition">
<p class="first admonition-title">Ukuran berkas dan satuan SI</p>
<p class="last">Strictly speaking, <code class="docutils literal notranslate"><span class="pre">filesizeformat</span></code> does not conform to the International
System of Units which recommends using KiB, MiB, GiB, etc. when byte sizes
are calculated in powers of 1024 (which is the case here). Instead, Django
uses traditional unit names (KB, MB, GB, etc.) corresponding to names that
are more commonly used.</p>
</div>
</div>
<div class="section" id="s-first">
<span id="s-std:templatefilter-first"></span><span id="first"></span><span id="std:templatefilter-first"></span><h3><code class="docutils literal notranslate"><span class="pre">first</span></code><a class="headerlink" href="#first" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan barang pertama dalam sebuah list.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">first</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah list <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c']</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">'a'</span></code>.</p>
</div>
<div class="section" id="s-floatformat">
<span id="s-std:templatefilter-floatformat"></span><span id="floatformat"></span><span id="std:templatefilter-floatformat"></span><h3><code class="docutils literal notranslate"><span class="pre">floatformat</span></code><a class="headerlink" href="#floatformat" title="Link permanen untuk headline ini">¶</a></h3>
<p>When used without an argument, rounds a floating-point number to one decimal
place -- but only if there's a decimal part to be displayed. For example:</p>
<table class="docutils">
<colgroup>
<col width="26%" />
<col width="57%" />
<col width="17%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><code class="docutils literal notranslate"><span class="pre">value</span></code></th>
<th class="head">Cetakan</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.23234</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.2</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">34.00000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.26000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.3</span></code></td>
</tr>
</tbody>
</table>
<p>Jika digunakan dengan argumen integer numerik, <code class="docutils literal notranslate"><span class="pre">floatformat</span></code> membulatkan ke sebanyak tempat desimal. Sebagai contoh:</p>
<table class="docutils">
<colgroup>
<col width="24%" />
<col width="57%" />
<col width="20%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><code class="docutils literal notranslate"><span class="pre">value</span></code></th>
<th class="head">Cetakan</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.23234</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:3</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.232</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">34.00000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:3</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.000</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.26000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:3</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.260</span></code></td>
</tr>
</tbody>
</table>
<p>Particularly useful is passing 0 (zero) as the argument which will round the
float to the nearest integer.</p>
<table class="docutils">
<colgroup>
<col width="22%" />
<col width="59%" />
<col width="19%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><code class="docutils literal notranslate"><span class="pre">value</span></code></th>
<th class="head">Cetakan</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.23234</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;0&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">34.00000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;0&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">39.56000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;0&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">40</span></code></td>
</tr>
</tbody>
</table>
<p>If the argument passed to <code class="docutils literal notranslate"><span class="pre">floatformat</span></code> is negative, it will round a number
to that many decimal places -- but only if there's a decimal part to be
displayed. For example:</p>
<table class="docutils">
<colgroup>
<col width="22%" />
<col width="59%" />
<col width="19%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><code class="docutils literal notranslate"><span class="pre">value</span></code></th>
<th class="head">Cetakan</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.23234</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;-3&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.232</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">34.00000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;-3&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">34.26000</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">value|floatformat:&quot;-3&quot;</span> <span class="pre">}}</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">34.260</span></code></td>
</tr>
</tbody>
</table>
<p>Using <code class="docutils literal notranslate"><span class="pre">floatformat</span></code> with no argument is equivalent to using <code class="docutils literal notranslate"><span class="pre">floatformat</span></code>
with an argument of <code class="docutils literal notranslate"><span class="pre">-1</span></code>.</p>
</div>
<div class="section" id="s-force-escape">
<span id="s-std:templatefilter-force_escape"></span><span id="force-escape"></span><span id="std:templatefilter-force_escape"></span><h3><code class="docutils literal notranslate"><span class="pre">force_escape</span></code><a class="headerlink" href="#force-escape" title="Link permanen untuk headline ini">¶</a></h3>
<p>Applies HTML escaping to a string (see the <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a> filter for
details). This filter is applied <em>immediately</em> and returns a new, escaped
string. This is useful in the rare cases where you need multiple escaping or
want to apply other filters to the escaped results. Normally, you want to use
the <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a> filter.</p>
<p>Sebagai contoh, jika anda ingin menangkap <code class="docutils literal notranslate"><span class="pre">&lt;p&gt;</span></code> unsur HTML dibuat oleh penyaring <a class="reference internal" href="#std:templatefilter-linebreaks"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">linebreaks</span></code></a>:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">autoescape</span> <span class="nv">off</span> <span class="cp">%}</span>
    <span class="cp">{{</span> <span class="nv">body</span><span class="o">|</span><span class="nf">linebreaks</span><span class="o">|</span><span class="nf">force_escape</span> <span class="cp">}}</span>
<span class="cp">{%</span> <span class="k">endautoescape</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-get-digit">
<span id="s-std:templatefilter-get_digit"></span><span id="get-digit"></span><span id="std:templatefilter-get_digit"></span><h3><code class="docutils literal notranslate"><span class="pre">get_digit</span></code><a class="headerlink" href="#get-digit" title="Link permanen untuk headline ini">¶</a></h3>
<p>Given a whole number, returns the requested digit, where 1 is the right-most
digit, 2 is the second-right-most digit, etc. Returns the original value for
invalid input (if input or argument is not an integer, or if argument is less
than 1). Otherwise, output is always an integer.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">get_digit</span><span class="s2">:&quot;2&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">123456789</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">8</span></code>.</p>
</div>
<div class="section" id="s-iriencode">
<span id="s-std:templatefilter-iriencode"></span><span id="iriencode"></span><span id="std:templatefilter-iriencode"></span><h3><code class="docutils literal notranslate"><span class="pre">iriencode</span></code><a class="headerlink" href="#iriencode" title="Link permanen untuk headline ini">¶</a></h3>
<p>Converts an IRI (Internationalized Resource Identifier) to a string that is
suitable for including in a URL. This is necessary if you're trying to use
strings containing non-ASCII characters in a URL.</p>
<p>Itu adalah aman menggunakan penyaring ini pada string yang sudah hilang melalui penyaring <a class="reference internal" href="#std:templatefilter-urlencode"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">urlencode</span></code></a>.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">iriencode</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;?test=1&amp;me=2&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">&quot;?test=1&amp;amp;me=2&quot;</span></code>.</p>
</div>
<div class="section" id="s-join">
<span id="s-std:templatefilter-join"></span><span id="join"></span><span id="std:templatefilter-join"></span><h3><code class="docutils literal notranslate"><span class="pre">join</span></code><a class="headerlink" href="#join" title="Link permanen untuk headline ini">¶</a></h3>
<p>Menggabungkan list dengan string, seperti <code class="docutils literal notranslate"><span class="pre">str.join(list)</span></code> Python</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">join</span><span class="s2">:&quot; // &quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah daftar <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c']</span></code>, keluaran akan menjadi deretan karakter <code class="docutils literal notranslate"><span class="pre">&quot;a</span> <span class="pre">//</span> <span class="pre">b</span> <span class="pre">//</span> <span class="pre">c&quot;</span></code>.</p>
</div>
<div class="section" id="s-json-script">
<span id="s-std:templatefilter-json_script"></span><span id="json-script"></span><span id="std:templatefilter-json_script"></span><h3><code class="docutils literal notranslate"><span class="pre">json_script</span></code><a class="headerlink" href="#json-script" title="Link permanen untuk headline ini">¶</a></h3>
<div class="versionadded">
<span class="title">New in Django 2.1.</span> </div>
<p>Dengan aman mengeluarkan sebuah obyek Python sebagai JSON, dibungkus dalam sebuah etiket <code class="docutils literal notranslate"><span class="pre">&lt;script&gt;</span></code>, siap digunakan dengan JavaScript.</p>
<p><strong>Argumen:</strong> &quot;id&quot; HTML dari etiket <code class="docutils literal notranslate"><span class="pre">&lt;script&gt;</span></code>.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">json_script</span><span class="s2">:&quot;hello-data&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah dictionary <code class="docutils literal notranslate"><span class="pre">{'hello':</span> <span class="pre">'world'}</span></code>, keluaran akan berupa:</p>
<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">script</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;hello-data&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;application/json&quot;</span><span class="p">&gt;{</span><span class="s2">&quot;hello&quot;</span><span class="o">:</span> <span class="s2">&quot;world&quot;</span><span class="p">}&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>Data hasil dapat diakses dalam JavaScript seperti ini:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="kd">var</span> <span class="nx">value</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">&#39;hello-data&#39;</span><span class="p">).</span><span class="nx">textContent</span><span class="p">);</span>
</pre></div>
</div>
<p>Serangan XSS dikurangi dengan meloloskan karakter &quot;&lt;&quot;, &quot;&gt;&quot; dan &quot;&amp;&quot;. Sebagai contoh jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">{'hello':</span> <span class="pre">'world&lt;/script&gt;&amp;amp;'}</span></code>, keluaran adalah:</p>
<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">script</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;hello-data&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;application/json&quot;</span><span class="p">&gt;{</span><span class="s2">&quot;hello&quot;</span><span class="o">:</span> <span class="s2">&quot;world\\u003C/script\\u003E\\u0026amp;&quot;</span><span class="p">}&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>This is compatible with a strict Content Security Policy that prohibits in-page
script execution. It also maintains a clean separation between passive data and
executable code.</p>
</div>
<div class="section" id="s-last">
<span id="s-std:templatefilter-last"></span><span id="last"></span><span id="std:templatefilter-last"></span><h3><code class="docutils literal notranslate"><span class="pre">last</span></code><a class="headerlink" href="#last" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan barang terakhir di daftar.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">last</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah daftar <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c',</span> <span class="pre">'d']</span></code>, keluaran akan menjadi deretan karakter <code class="docutils literal notranslate"><span class="pre">&quot;d&quot;</span></code>.</p>
</div>
<div class="section" id="s-length">
<span id="s-std:templatefilter-length"></span><span id="length"></span><span id="std:templatefilter-length"></span><h3><code class="docutils literal notranslate"><span class="pre">length</span></code><a class="headerlink" href="#length" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan panjang nilai. Ini bekerja pada kedua deretan karakter dan daftar.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">length</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c',</span> <span class="pre">'d']</span></code> atau <code class="docutils literal notranslate"><span class="pre">&quot;abcd&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">4</span></code>.</p>
<p>Penyaring mengembalikan <code class="docutils literal notranslate"><span class="pre">0</span></code> untuk variabel tidak ditentukan.</p>
</div>
<div class="section" id="s-length-is">
<span id="s-std:templatefilter-length_is"></span><span id="length-is"></span><span id="std:templatefilter-length_is"></span><h3><code class="docutils literal notranslate"><span class="pre">length_is</span></code><a class="headerlink" href="#length-is" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan <code class="docutils literal notranslate"><span class="pre">True</span></code> jika panjang nilai adalah argumen, atau <code class="docutils literal notranslate"><span class="pre">False</span></code> sebaliknya.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">length_is</span><span class="s2">:&quot;4&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c',</span> <span class="pre">'d']</span></code> atau <code class="docutils literal notranslate"><span class="pre">&quot;abcd&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</div>
<div class="section" id="s-linebreaks">
<span id="s-std:templatefilter-linebreaks"></span><span id="linebreaks"></span><span id="std:templatefilter-linebreaks"></span><h3><code class="docutils literal notranslate"><span class="pre">linebreaks</span></code><a class="headerlink" href="#linebreaks" title="Link permanen untuk headline ini">¶</a></h3>
<p>Replaces line breaks in plain text with appropriate HTML; a single
newline becomes an HTML line break (<code class="docutils literal notranslate"><span class="pre">&lt;br&gt;</span></code>) and a new line
followed by a blank line becomes a paragraph break (<code class="docutils literal notranslate"><span class="pre">&lt;/p&gt;</span></code>).</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">linebreaks</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">Joel\nis</span> <span class="pre">a</span> <span class="pre">slug</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&lt;p&gt;Joel&lt;br&gt;is</span> <span class="pre">a</span> <span class="pre">slug&lt;/p&gt;</span></code>.</p>
</div>
<div class="section" id="s-linebreaksbr">
<span id="s-std:templatefilter-linebreaksbr"></span><span id="linebreaksbr"></span><span id="std:templatefilter-linebreaksbr"></span><h3><code class="docutils literal notranslate"><span class="pre">linebreaksbr</span></code><a class="headerlink" href="#linebreaksbr" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah semua baris baru dalam potongan teks polos menjadi jeda baris HTML (<code class="docutils literal notranslate"><span class="pre">&lt;br&gt;</span></code>).</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">linebreaksbr</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">Joel\nis</span> <span class="pre">a</span> <span class="pre">slug</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">Joel&lt;br&gt;is</span> <span class="pre">a</span> <span class="pre">slug</span></code>.</p>
</div>
<div class="section" id="s-linenumbers">
<span id="s-std:templatefilter-linenumbers"></span><span id="linenumbers"></span><span id="std:templatefilter-linenumbers"></span><h3><code class="docutils literal notranslate"><span class="pre">linenumbers</span></code><a class="headerlink" href="#linenumbers" title="Link permanen untuk headline ini">¶</a></h3>
<p>Menampilkan teks dengan baris angka.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">linenumbers</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>one
two
three
</pre></div>
</div>
<p>keluaran akan menjadi:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>1. one
2. two
3. three
</pre></div>
</div>
</div>
<div class="section" id="s-ljust">
<span id="s-std:templatefilter-ljust"></span><span id="ljust"></span><span id="std:templatefilter-ljust"></span><h3><code class="docutils literal notranslate"><span class="pre">ljust</span></code><a class="headerlink" href="#ljust" title="Link permanen untuk headline ini">¶</a></h3>
<p>Rata-kiri nilai dalam sebuah bidang dari lebar yang diberikan.</p>
<p><strong>Argumen:</strong> ukuran bidang</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>&quot;<span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">ljust</span><span class="s2">:&quot;10&quot;</span> <span class="cp">}}</span>&quot;
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">Django</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;Django</span>&#160;&#160;&#160; <span class="pre">&quot;</span></code>.</p>
</div>
<div class="section" id="s-lower">
<span id="s-std:templatefilter-lower"></span><span id="lower"></span><span id="std:templatefilter-lower"></span><h3><code class="docutils literal notranslate"><span class="pre">lower</span></code><a class="headerlink" href="#lower" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah string menjadi huruf kecil semua.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">lower</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">Totally</span> <span class="pre">LOVING</span> <span class="pre">this</span> <span class="pre">Album!</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">totally</span> <span class="pre">loving</span> <span class="pre">this</span> <span class="pre">album!</span></code>.</p>
</div>
<div class="section" id="s-make-list">
<span id="s-std:templatefilter-make_list"></span><span id="make-list"></span><span id="std:templatefilter-make_list"></span><h3><code class="docutils literal notranslate"><span class="pre">make_list</span></code><a class="headerlink" href="#make-list" title="Link permanen untuk headline ini">¶</a></h3>
<p>Returns the value turned into a list. For a string, it's a list of characters.
For an integer, the argument is cast to a string before creating a list.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">make_list</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah string <code class="docutils literal notranslate"><span class="pre">&quot;Joel&quot;</span></code>, keluara akan berupa list <code class="docutils literal notranslate"><span class="pre">['J',</span> <span class="pre">'o',</span> <span class="pre">'e',</span> <span class="pre">'l']</span></code>. Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">123</span></code>, keluaran akan berupa list <code class="docutils literal notranslate"><span class="pre">['1',</span> <span class="pre">'2',</span> <span class="pre">'3']</span></code>.</p>
</div>
<div class="section" id="s-phone2numeric">
<span id="s-std:templatefilter-phone2numeric"></span><span id="phone2numeric"></span><span id="std:templatefilter-phone2numeric"></span><h3><code class="docutils literal notranslate"><span class="pre">phone2numeric</span></code><a class="headerlink" href="#phone2numeric" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah nomor telepon (kemunginan mengandung huruf) ke setara numeriknya.</p>
<p>Masukan tidak harus berupa nomor telepon sah. Ini akan membuat bahagia merubah string apapun.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">phone2numeric</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">800-COLLECT</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">800-2655328</span></code>.</p>
</div>
<div class="section" id="s-pluralize">
<span id="s-std:templatefilter-pluralize"></span><span id="pluralize"></span><span id="std:templatefilter-pluralize"></span><h3><code class="docutils literal notranslate"><span class="pre">pluralize</span></code><a class="headerlink" href="#pluralize" title="Link permanen untuk headline ini">¶</a></h3>
<p>Returns a plural suffix if the value is not <code class="docutils literal notranslate"><span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">'1'</span></code>, or an object of
length 1. By default, this suffix is <code class="docutils literal notranslate"><span class="pre">'s'</span></code>.</p>
<p>Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>You have <span class="cp">{{</span> <span class="nv">num_messages</span> <span class="cp">}}</span> message<span class="cp">{{</span> <span class="nv">num_messages</span><span class="o">|</span><span class="nf">pluralize</span> <span class="cp">}}</span>.
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">num_messages</span></code> adalah <code class="docutils literal notranslate"><span class="pre">1</span></code>, keluaran kan berupa <code class="docutils literal notranslate"><span class="pre">You</span> <span class="pre">have</span> <span class="pre">1</span> <span class="pre">message.</span></code> Jika <code class="docutils literal notranslate"><span class="pre">num_messages</span></code> adalah <code class="docutils literal notranslate"><span class="pre">2</span></code>  keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">You</span> <span class="pre">have</span> <span class="pre">2</span> <span class="pre">messages.</span></code></p>
<p>For words that require a suffix other than <code class="docutils literal notranslate"><span class="pre">'s'</span></code>, you can provide an alternate
suffix as a parameter to the filter.</p>
<p>Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>You have <span class="cp">{{</span> <span class="nv">num_walruses</span> <span class="cp">}}</span> walrus<span class="cp">{{</span> <span class="nv">num_walruses</span><span class="o">|</span><span class="nf">pluralize</span><span class="s2">:&quot;es&quot;</span> <span class="cp">}}</span>.
</pre></div>
</div>
<p>For words that don't pluralize by simple suffix, you can specify both a
singular and plural suffix, separated by a comma.</p>
<p>Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>You have <span class="cp">{{</span> <span class="nv">num_cherries</span> <span class="cp">}}</span> cherr<span class="cp">{{</span> <span class="nv">num_cherries</span><span class="o">|</span><span class="nf">pluralize</span><span class="s2">:&quot;y,ies&quot;</span> <span class="cp">}}</span>.
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p class="last">Gunakan <a class="reference internal" href="../../topics/i18n/translation.html#std:templatetag-blocktrans"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">blocktrans</span></code></a> untuk menjamakkan string terjemahan.</p>
</div>
</div>
<div class="section" id="s-pprint">
<span id="s-std:templatefilter-pprint"></span><span id="pprint"></span><span id="std:templatefilter-pprint"></span><h3><code class="docutils literal notranslate"><span class="pre">pprint</span></code><a class="headerlink" href="#pprint" title="Link permanen untuk headline ini">¶</a></h3>
<p>Sebuah pembungkus disekitar <a class="reference external" href="https://docs.python.org/3/library/pprint.html#pprint.pprint" title="(di Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">pprint.pprint()</span></code></a> -- untuk mencari kesalahan, sungguh.</p>
</div>
<div class="section" id="s-random">
<span id="s-std:templatefilter-random"></span><span id="random"></span><span id="std:templatefilter-random"></span><h3><code class="docutils literal notranslate"><span class="pre">random</span></code><a class="headerlink" href="#random" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan barang acak dari list yang diberikan.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">random</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah list <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c',</span> <span class="pre">'d']</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;b&quot;</span></code>.</p>
</div>
<div class="section" id="s-rjust">
<span id="s-std:templatefilter-rjust"></span><span id="rjust"></span><span id="std:templatefilter-rjust"></span><h3><code class="docutils literal notranslate"><span class="pre">rjust</span></code><a class="headerlink" href="#rjust" title="Link permanen untuk headline ini">¶</a></h3>
<p>Right-aligns the value in a field of a given width.</p>
<p><strong>Argumen:</strong> ukuran bidang</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>&quot;<span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">rjust</span><span class="s2">:&quot;10&quot;</span> <span class="cp">}}</span>&quot;
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">Django</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">&quot;</span> <span class="pre">Django&quot;</span></code>.</p>
</div>
<div class="section" id="s-safe">
<span id="s-std:templatefilter-safe"></span><span id="safe"></span><span id="std:templatefilter-safe"></span><h3><code class="docutils literal notranslate"><span class="pre">safe</span></code><a class="headerlink" href="#safe" title="Link permanen untuk headline ini">¶</a></h3>
<p>Marks a string as not requiring further HTML escaping prior to output. When
autoescaping is off, this filter has no effect.</p>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p>If you are chaining filters, a filter applied after <code class="docutils literal notranslate"><span class="pre">safe</span></code> can
make the contents unsafe again. For example, the following code
prints the variable as is, unescaped:</p>
<div class="last highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">var</span><span class="o">|</span><span class="nf">safe</span><span class="o">|</span><span class="nf">escape</span> <span class="cp">}}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="s-safeseq">
<span id="s-std:templatefilter-safeseq"></span><span id="safeseq"></span><span id="std:templatefilter-safeseq"></span><h3><code class="docutils literal notranslate"><span class="pre">safeseq</span></code><a class="headerlink" href="#safeseq" title="Link permanen untuk headline ini">¶</a></h3>
<p>Applies the <a class="reference internal" href="#std:templatefilter-safe"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">safe</span></code></a> filter to each element of a sequence. Useful in
conjunction with other filters that operate on sequences, such as
<a class="reference internal" href="#std:templatefilter-join"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">join</span></code></a>. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">some_list</span><span class="o">|</span><span class="nf">safeseq</span><span class="o">|</span><span class="nf">join</span><span class="s2">:&quot;, &quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>You couldn't use the <a class="reference internal" href="#std:templatefilter-safe"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">safe</span></code></a> filter directly in this case, as it would
first convert the variable into a string, rather than working with the
individual elements of the sequence.</p>
</div>
<div class="section" id="s-slice">
<span id="s-std:templatefilter-slice"></span><span id="slice"></span><span id="std:templatefilter-slice"></span><h3><code class="docutils literal notranslate"><span class="pre">slice</span></code><a class="headerlink" href="#slice" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan potongan dari list.</p>
<p>Uses the same syntax as Python's list slicing. See
<a class="reference external" href="https://www.diveinto.org/python3/native-datatypes.html#slicinglists">https://www.diveinto.org/python3/native-datatypes.html#slicinglists</a>
for an introduction.</p>
<p>Contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">some_list</span><span class="o">|</span><span class="nf">slice</span><span class="s2">:&quot;:2&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">some_list</span></code> is <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b',</span> <span class="pre">'c']</span></code>, keluaran akn berupa <code class="docutils literal notranslate"><span class="pre">['a',</span> <span class="pre">'b']</span></code>.</p>
</div>
<div class="section" id="s-slugify">
<span id="s-std:templatefilter-slugify"></span><span id="slugify"></span><span id="std:templatefilter-slugify"></span><h3><code class="docutils literal notranslate"><span class="pre">slugify</span></code><a class="headerlink" href="#slugify" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah ke ASCII. Merubah ruang menjadi tanda garis. Memindahkan karakter yang tidak alphanumerik, garis bawah, atau tanda garis. Merubah ke huruf kecil. Juga melucuti terkemuka dan buntutan ruang kosong.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">slugify</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;joel-is-a-slug&quot;</span></code>.</p>
</div>
<div class="section" id="s-stringformat">
<span id="s-std:templatefilter-stringformat"></span><span id="stringformat"></span><span id="std:templatefilter-stringformat"></span><h3><code class="docutils literal notranslate"><span class="pre">stringformat</span></code><a class="headerlink" href="#stringformat" title="Link permanen untuk headline ini">¶</a></h3>
<p>Formats the variable according to the argument, a string formatting specifier.
This specifier uses the <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#old-string-formatting" title="(di Python v3.8)"><span>printf-style String Formatting</span></a> syntax, with the exception
that the leading &quot;%&quot; is dropped.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">stringformat</span><span class="s2">:&quot;E&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">10</span></code>, keluaran kana berupa <code class="docutils literal notranslate"><span class="pre">1.000000E+01</span></code>.</p>
</div>
<div class="section" id="s-striptags">
<span id="s-std:templatefilter-striptags"></span><span id="striptags"></span><span id="std:templatefilter-striptags"></span><h3><code class="docutils literal notranslate"><span class="pre">striptags</span></code><a class="headerlink" href="#striptags" title="Link permanen untuk headline ini">¶</a></h3>
<p>Membuat semua kemungkinan usaha untuk menghapus semua etiket [X]HTML.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">striptags</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;&lt;b&gt;Joel&lt;/b&gt;</span> <span class="pre">&lt;button&gt;is&lt;/button&gt;</span> <span class="pre">a</span> <span class="pre">&lt;span&gt;slug&lt;/span&gt;&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>.</p>
<div class="admonition-no-safety-guarantee admonition">
<p class="first admonition-title">Tidak ada jaminan keamanan</p>
<p class="last">Note that <code class="docutils literal notranslate"><span class="pre">striptags</span></code> doesn't give any guarantee about its output being
HTML safe, particularly with non valid HTML input. So <strong>NEVER</strong> apply the
<code class="docutils literal notranslate"><span class="pre">safe</span></code> filter to a <code class="docutils literal notranslate"><span class="pre">striptags</span></code> output. If you are looking for something
more robust, you can use the <code class="docutils literal notranslate"><span class="pre">bleach</span></code> Python library, notably its
<a class="reference external" href="https://bleach.readthedocs.io/en/latest/clean.html">clean</a> method.</p>
</div>
</div>
<div class="section" id="s-time">
<span id="s-std:templatefilter-time"></span><span id="time"></span><span id="std:templatefilter-time"></span><h3><code class="docutils literal notranslate"><span class="pre">time</span></code><a class="headerlink" href="#time" title="Link permanen untuk headline ini">¶</a></h3>
<p>Bentuk waktu menurut pada bentuk yang diberikan.</p>
<p>Given format can be the predefined one <a class="reference internal" href="../settings.html#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a>, or a custom
format, same as the <a class="reference internal" href="#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> filter. Note that the predefined format
is locale-dependent.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">time</span><span class="s2">:&quot;H:i&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> setara pada <code class="docutils literal notranslate"><span class="pre">datetime.datetime.now()</span></code>, keluaran akan berupa string <code class="docutils literal notranslate"><span class="pre">&quot;01:23&quot;</span></code>.</p>
<p>Contoh lain:</p>
<p>Anggap bahwa <a class="reference internal" href="../settings.html#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> adalah <code class="docutils literal notranslate"><span class="pre">True</span></code> dan <a class="reference internal" href="../settings.html#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a> adalah, sebagai contoh, <code class="docutils literal notranslate"><span class="pre">&quot;de&quot;</span></code>, kemudian untuk:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">time</span><span class="s2">:&quot;TIME_FORMAT&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>the output will be the string <code class="docutils literal notranslate"><span class="pre">&quot;01:23&quot;</span></code> (The <code class="docutils literal notranslate"><span class="pre">&quot;TIME_FORMAT&quot;</span></code> format
specifier for the <code class="docutils literal notranslate"><span class="pre">de</span></code> locale as shipped with Django is <code class="docutils literal notranslate"><span class="pre">&quot;H:i&quot;</span></code>).</p>
<p>The <code class="docutils literal notranslate"><span class="pre">time</span></code> filter will only accept parameters in the format string that
relate to the time of day, not the date (for obvious reasons). If you need to
format a <code class="docutils literal notranslate"><span class="pre">date</span></code> value, use the <a class="reference internal" href="#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> filter instead (or along
<code class="docutils literal notranslate"><span class="pre">time</span></code> if you need to render a full <a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(di Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime</span></code></a> value).</p>
<p>There is one exception the above rule: When passed a <code class="docutils literal notranslate"><span class="pre">datetime</span></code> value with
attached timezone information (a <a class="reference internal" href="../../topics/i18n/timezones.html#naive-vs-aware-datetimes"><span class="std std-ref">time-zone-aware</span></a> <code class="docutils literal notranslate"><span class="pre">datetime</span></code> instance) the <code class="docutils literal notranslate"><span class="pre">time</span></code> filter will
accept the timezone-related <a class="reference internal" href="#date-and-time-formatting-specifiers"><span class="std std-ref">format specifiers</span></a> <code class="docutils literal notranslate"><span class="pre">'e'</span></code>, <code class="docutils literal notranslate"><span class="pre">'O'</span></code> , <code class="docutils literal notranslate"><span class="pre">'T'</span></code> and <code class="docutils literal notranslate"><span class="pre">'Z'</span></code>.</p>
<p>Ketika digunakan tanpa bentuk string, penentu bentuk <code class="docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code> digunakan:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">time</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>adalah sama seperti:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">time</span><span class="s2">:&quot;TIME_FORMAT&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
</div>
<div class="section" id="s-timesince">
<span id="s-std:templatefilter-timesince"></span><span id="timesince"></span><span id="std:templatefilter-timesince"></span><h3><code class="docutils literal notranslate"><span class="pre">timesince</span></code><a class="headerlink" href="#timesince" title="Link permanen untuk headline ini">¶</a></h3>
<p>Bentuk tanggal seperti waktu sejak tanggal itu (misalnya, &quot;4 days, 6 hours&quot;).</p>
<p>Takes an optional argument that is a variable containing the date to use as
the comparison point (without the argument, the comparison point is <em>now</em>).
For example, if <code class="docutils literal notranslate"><span class="pre">blog_date</span></code> is a date instance representing midnight on 1
June 2006, and <code class="docutils literal notranslate"><span class="pre">comment_date</span></code> is a date instance for 08:00 on 1 June 2006,
then the following would return &quot;8 hours&quot;:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">blog_date</span><span class="o">|</span><span class="nf">timesince</span><span class="o">:</span><span class="nv">comment_date</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Comparing offset-naive and offset-aware datetimes will return an empty string.</p>
<p>Minutes is the smallest unit used, and &quot;0 minutes&quot; will be returned for any
date that is in the future relative to the comparison point.</p>
</div>
<div class="section" id="s-timeuntil">
<span id="s-std:templatefilter-timeuntil"></span><span id="timeuntil"></span><span id="std:templatefilter-timeuntil"></span><h3><code class="docutils literal notranslate"><span class="pre">timeuntil</span></code><a class="headerlink" href="#timeuntil" title="Link permanen untuk headline ini">¶</a></h3>
<p>Similar to <code class="docutils literal notranslate"><span class="pre">timesince</span></code>, except that it measures the time from now until the
given date or datetime. For example, if today is 1 June 2006 and
<code class="docutils literal notranslate"><span class="pre">conference_date</span></code> is a date instance holding 29 June 2006, then
<code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">conference_date|timeuntil</span> <span class="pre">}}</span></code> will return &quot;4 weeks&quot;.</p>
<p>Takes an optional argument that is a variable containing the date to use as
the comparison point (instead of <em>now</em>). If <code class="docutils literal notranslate"><span class="pre">from_date</span></code> contains 22 June
2006, then the following will return &quot;1 week&quot;:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">conference_date</span><span class="o">|</span><span class="nf">timeuntil</span><span class="o">:</span><span class="nv">from_date</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Comparing offset-naive and offset-aware datetimes will return an empty string.</p>
<p>Minutes is the smallest unit used, and &quot;0 minutes&quot; will be returned for any
date that is in the past relative to the comparison point.</p>
</div>
<div class="section" id="s-title">
<span id="s-std:templatefilter-title"></span><span id="title"></span><span id="std:templatefilter-title"></span><h3><code class="docutils literal notranslate"><span class="pre">title</span></code><a class="headerlink" href="#title" title="Link permanen untuk headline ini">¶</a></h3>
<p>Converts a string into titlecase by making words start with an uppercase
character and the remaining characters lowercase. This tag makes no effort to
keep &quot;trivial words&quot; in lowercase.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">title</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;my</span> <span class="pre">FIRST</span> <span class="pre">post&quot;</span></code>,keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;My</span> <span class="pre">First</span> <span class="pre">Post&quot;</span></code>.</p>
</div>
<div class="section" id="s-truncatechars">
<span id="s-std:templatefilter-truncatechars"></span><span id="truncatechars"></span><span id="std:templatefilter-truncatechars"></span><h3><code class="docutils literal notranslate"><span class="pre">truncatechars</span></code><a class="headerlink" href="#truncatechars" title="Link permanen untuk headline ini">¶</a></h3>
<p>Truncates a string if it is longer than the specified number of characters.
Truncated strings will end with a translatable ellipsis character (&quot;…&quot;).</p>
<p><strong>Argumen:</strong> Jumah karakter dipotong</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">truncatechars</span><span class="o">:</span><span class="m">7</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">value</span></code> is <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>, the output will be <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">i…&quot;</span></code>.</p>
</div>
<div class="section" id="s-truncatechars-html">
<span id="s-std:templatefilter-truncatechars_html"></span><span id="truncatechars-html"></span><span id="std:templatefilter-truncatechars_html"></span><h3><code class="docutils literal notranslate"><span class="pre">truncatechars_html</span></code><a class="headerlink" href="#truncatechars-html" title="Link permanen untuk headline ini">¶</a></h3>
<p>Similar to <a class="reference internal" href="#std:templatefilter-truncatechars"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">truncatechars</span></code></a>, except that it is aware of HTML tags. Any
tags that are opened in the string and not closed before the truncation point
are closed immediately after the truncation.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">truncatechars_html</span><span class="o">:</span><span class="m">7</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">value</span></code> is <code class="docutils literal notranslate"><span class="pre">&quot;&lt;p&gt;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&lt;/p&gt;&quot;</span></code>, the output will be
<code class="docutils literal notranslate"><span class="pre">&quot;&lt;p&gt;Joel</span> <span class="pre">i…&lt;/p&gt;&quot;</span></code>.</p>
<p>Baris baru dalam isi HTML akan dipertahankan</p>
</div>
<div class="section" id="s-truncatewords">
<span id="s-std:templatefilter-truncatewords"></span><span id="truncatewords"></span><span id="std:templatefilter-truncatewords"></span><h3><code class="docutils literal notranslate"><span class="pre">truncatewords</span></code><a class="headerlink" href="#truncatewords" title="Link permanen untuk headline ini">¶</a></h3>
<p>Memotong sebuah string setelah sejumlah angka dari kata.</p>
<p><strong>Argumen:</strong> Jumlah kata untuk dipotong setelahnya</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">truncatewords</span><span class="o">:</span><span class="m">2</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">…&quot;</span></code>.</p>
<p>Baris baru dalam string akan dipindahkan.</p>
</div>
<div class="section" id="s-truncatewords-html">
<span id="s-std:templatefilter-truncatewords_html"></span><span id="truncatewords-html"></span><span id="std:templatefilter-truncatewords_html"></span><h3><code class="docutils literal notranslate"><span class="pre">truncatewords_html</span></code><a class="headerlink" href="#truncatewords-html" title="Link permanen untuk headline ini">¶</a></h3>
<p>Similar to <a class="reference internal" href="#std:templatefilter-truncatewords"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">truncatewords</span></code></a>, except that it is aware of HTML tags. Any
tags that are opened in the string and not closed before the truncation point,
are closed immediately after the truncation.</p>
<p>This is less efficient than <a class="reference internal" href="#std:templatefilter-truncatewords"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">truncatewords</span></code></a>, so should only be used
when it is being passed HTML text.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">truncatewords_html</span><span class="o">:</span><span class="m">2</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;&lt;p&gt;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&lt;/p&gt;&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;&lt;p&gt;Joel</span> <span class="pre">is</span> <span class="pre">…&lt;/p&gt;&quot;</span></code>.</p>
<p>Baris baru dalam isi HTML akan dipertahankan</p>
</div>
<div class="section" id="s-unordered-list">
<span id="s-std:templatefilter-unordered_list"></span><span id="unordered-list"></span><span id="std:templatefilter-unordered_list"></span><h3><code class="docutils literal notranslate"><span class="pre">unordered_list</span></code><a class="headerlink" href="#unordered-list" title="Link permanen untuk headline ini">¶</a></h3>
<p>Recursively takes a self-nested list and returns an HTML unordered list --
WITHOUT opening and closing &lt;ul&gt; tags.</p>
<p>The list is assumed to be in the proper format. For example, if <code class="docutils literal notranslate"><span class="pre">var</span></code>
contains <code class="docutils literal notranslate"><span class="pre">['States',</span> <span class="pre">['Kansas',</span> <span class="pre">['Lawrence',</span> <span class="pre">'Topeka'],</span> <span class="pre">'Illinois']]</span></code>, then
<code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">var|unordered_list</span> <span class="pre">}}</span></code> would return:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>States
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Kansas
        <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Lawrence<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Topeka<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
        <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
        <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Illinois<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-upper">
<span id="s-std:templatefilter-upper"></span><span id="upper"></span><span id="std:templatefilter-upper"></span><h3><code class="docutils literal notranslate"><span class="pre">upper</span></code><a class="headerlink" href="#upper" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah string kedalam semua huruf besar.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">upper</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;JOEL</span> <span class="pre">IS</span> <span class="pre">A</span> <span class="pre">SLUG&quot;</span></code>.</p>
</div>
<div class="section" id="s-urlencode">
<span id="s-std:templatefilter-urlencode"></span><span id="urlencode"></span><span id="std:templatefilter-urlencode"></span><h3><code class="docutils literal notranslate"><span class="pre">urlencode</span></code><a class="headerlink" href="#urlencode" title="Link permanen untuk headline ini">¶</a></h3>
<p>Meloloskan sebuah nilai untuk digunakan dalam sebuah URL.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">urlencode</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;https://www.example.org/foo?a=b&amp;c=d&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">&quot;https%3A//www.example.org/foo%3Fa%3Db%26c%3Dd&quot;</span></code>.</p>
<p>Sebuah argumen pilihan mengandung karakter yang harus tidak diloloskan dapat disediakan.</p>
<p>If not provided, the '/' character is assumed safe. An empty string can be
provided when <em>all</em> characters should be escaped. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">urlencode</span><span class="s2">:&quot;&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">value</span></code> is <code class="docutils literal notranslate"><span class="pre">&quot;https://www.example.org/&quot;</span></code>, the output will be
<code class="docutils literal notranslate"><span class="pre">&quot;https%3A%2F%2Fwww.example.org%2F&quot;</span></code>.</p>
</div>
<div class="section" id="s-urlize">
<span id="s-std:templatefilter-urlize"></span><span id="urlize"></span><span id="std:templatefilter-urlize"></span><h3><code class="docutils literal notranslate"><span class="pre">urlize</span></code><a class="headerlink" href="#urlize" title="Link permanen untuk headline ini">¶</a></h3>
<p>Merubah URL dan alamat surel dalam teks menjadi tautan dapat di klik.</p>
<p>This template tag works on links prefixed with <code class="docutils literal notranslate"><span class="pre">http://</span></code>, <code class="docutils literal notranslate"><span class="pre">https://</span></code>, or
<code class="docutils literal notranslate"><span class="pre">www.</span></code>. For example, <code class="docutils literal notranslate"><span class="pre">https://goo.gl/aia1t</span></code> will get converted but
<code class="docutils literal notranslate"><span class="pre">goo.gl/aia1t</span></code> won't.</p>
<p>It also supports domain-only links ending in one of the original top level
domains (<code class="docutils literal notranslate"><span class="pre">.com</span></code>, <code class="docutils literal notranslate"><span class="pre">.edu</span></code>, <code class="docutils literal notranslate"><span class="pre">.gov</span></code>, <code class="docutils literal notranslate"><span class="pre">.int</span></code>, <code class="docutils literal notranslate"><span class="pre">.mil</span></code>, <code class="docutils literal notranslate"><span class="pre">.net</span></code>, and
<code class="docutils literal notranslate"><span class="pre">.org</span></code>). For example, <code class="docutils literal notranslate"><span class="pre">djangoproject.com</span></code> gets converted.</p>
<p>Links can have trailing punctuation (periods, commas, close-parens) and leading
punctuation (opening parens), and <code class="docutils literal notranslate"><span class="pre">urlize</span></code> will still do the right thing.</p>
<p>Tautan yang dibangkitkan oleh <code class="docutils literal notranslate"><span class="pre">urlize</span></code> mempunyai sebuah atribut <code class="docutils literal notranslate"><span class="pre">rel=&quot;nofollow&quot;</span></code> ditambahkan ke mereka.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">urlize</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">value</span></code> is <code class="docutils literal notranslate"><span class="pre">&quot;Check</span> <span class="pre">out</span> <span class="pre">www.djangoproject.com&quot;</span></code>, the output will be
<code class="docutils literal notranslate"><span class="pre">&quot;Check</span> <span class="pre">out</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;http://www.djangoproject.com&quot;</span>
<span class="pre">rel=&quot;nofollow&quot;&gt;www.djangoproject.com&lt;/a&gt;&quot;</span></code>.</p>
<p>In addition to web links, <code class="docutils literal notranslate"><span class="pre">urlize</span></code> also converts email addresses into
<code class="docutils literal notranslate"><span class="pre">mailto:</span></code> links. If <code class="docutils literal notranslate"><span class="pre">value</span></code> is
<code class="docutils literal notranslate"><span class="pre">&quot;Send</span> <span class="pre">questions</span> <span class="pre">to</span> <span class="pre">foo&#64;example.com&quot;</span></code>, the output will be
<code class="docutils literal notranslate"><span class="pre">&quot;Send</span> <span class="pre">questions</span> <span class="pre">to</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;mailto:foo&#64;example.com&quot;&gt;foo&#64;example.com&lt;/a&gt;&quot;</span></code>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">urlize</span></code> filter also takes an optional parameter <code class="docutils literal notranslate"><span class="pre">autoescape</span></code>. If
<code class="docutils literal notranslate"><span class="pre">autoescape</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the link text and URLs will be escaped using
Django's built-in <a class="reference internal" href="#std:templatefilter-escape"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">escape</span></code></a> filter. The default value for
<code class="docutils literal notranslate"><span class="pre">autoescape</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Catatan</p>
<p class="last">If <code class="docutils literal notranslate"><span class="pre">urlize</span></code> is applied to text that already contains HTML markup, or to
email addresses that contain single quotes (<code class="docutils literal notranslate"><span class="pre">'</span></code>), things won't work as
expected. Apply this filter only to plain text.</p>
</div>
</div>
<div class="section" id="s-urlizetrunc">
<span id="s-std:templatefilter-urlizetrunc"></span><span id="urlizetrunc"></span><span id="std:templatefilter-urlizetrunc"></span><h3><code class="docutils literal notranslate"><span class="pre">urlizetrunc</span></code><a class="headerlink" href="#urlizetrunc" title="Link permanen untuk headline ini">¶</a></h3>
<p>Converts URLs and email addresses into clickable links just like <a class="reference internal" href="#urlize">urlize</a>, but
truncates URLs longer than the given character limit.</p>
<p><strong>Argument:</strong> Number of characters that link text should be truncated to,
including the ellipsis that's added if truncation is necessary.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">urlizetrunc</span><span class="o">:</span><span class="m">15</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalaj <code class="docutils literal notranslate"><span class="pre">&quot;Check</span> <span class="pre">out</span> <span class="pre">www.djangoproject.com&quot;</span></code>, keluaran akan berupa <code class="docutils literal notranslate"><span class="pre">'Check</span> <span class="pre">out</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;http://www.djangoproject.com&quot;</span> <span class="pre">rel=&quot;nofollow&quot;&gt;www.djangoproj…&lt;/a&gt;'</span></code>.</p>
<p>As with <a class="reference internal" href="#urlize">urlize</a>, this filter should only be applied to plain text.</p>
</div>
<div class="section" id="s-wordcount">
<span id="s-std:templatefilter-wordcount"></span><span id="wordcount"></span><span id="std:templatefilter-wordcount"></span><h3><code class="docutils literal notranslate"><span class="pre">wordcount</span></code><a class="headerlink" href="#wordcount" title="Link permanen untuk headline ini">¶</a></h3>
<p>Mengembalikan sejumlah kata.</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">wordcount</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> adalah <code class="docutils literal notranslate"><span class="pre">&quot;Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug&quot;</span></code>, keluaran akan menjadi <code class="docutils literal notranslate"><span class="pre">4</span></code>.</p>
</div>
<div class="section" id="s-wordwrap">
<span id="s-std:templatefilter-wordwrap"></span><span id="wordwrap"></span><span id="std:templatefilter-wordwrap"></span><h3><code class="docutils literal notranslate"><span class="pre">wordwrap</span></code><a class="headerlink" href="#wordwrap" title="Link permanen untuk headline ini">¶</a></h3>
<p>Membungkus kata pada panjang baris ditentukan.</p>
<p><strong>Argumen:</strong> jumlah dari karakter dimana membungkus teks</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">wordwrap</span><span class="o">:</span><span class="m">5</span> <span class="cp">}}</span>
</pre></div>
</div>
<p>Jika <code class="docutils literal notranslate"><span class="pre">value</span></code> is <code class="docutils literal notranslate"><span class="pre">Joel</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">slug</span></code>, keluaran akan menjadi:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span>Joel
is a
slug
</pre></div>
</div>
</div>
<div class="section" id="s-yesno">
<span id="s-std:templatefilter-yesno"></span><span id="yesno"></span><span id="std:templatefilter-yesno"></span><h3><code class="docutils literal notranslate"><span class="pre">yesno</span></code><a class="headerlink" href="#yesno" title="Link permanen untuk headline ini">¶</a></h3>
<p>Maps values for <code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">False</span></code>, and (optionally) <code class="docutils literal notranslate"><span class="pre">None</span></code>, to the strings
&quot;yes&quot;, &quot;no&quot;, &quot;maybe&quot;, or a custom mapping passed as a comma-separated list, and
returns one of those strings according to the value:</p>
<p>Sebagai contoh:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{{</span> <span class="nv">value</span><span class="o">|</span><span class="nf">yesno</span><span class="s2">:&quot;yeah,no,maybe&quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
<table class="docutils">
<colgroup>
<col width="13%" />
<col width="29%" />
<col width="57%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Nilai</th>
<th class="head">Argument</th>
<th class="head">Keluaran</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">True</span></code></td>
<td>&#160;</td>
<td><code class="docutils literal notranslate"><span class="pre">yes</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">True</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">&quot;yeah,no,maybe&quot;</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">yeah</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">False</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">&quot;yeah,no,maybe&quot;</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">no</span></code></td>
</tr>
<tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">None</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">&quot;yeah,no,maybe&quot;</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">maybe</span></code></td>
</tr>
<tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">None</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">&quot;yeah,no&quot;</span></code></td>
<td><code class="docutils literal notranslate"><span class="pre">no</span></code> (merubah <code class="docutils literal notranslate"><span class="pre">None</span></code> menjadi <code class="docutils literal notranslate"><span class="pre">False</span></code> jika tidak ada pemetaan untuk <code class="docutils literal notranslate"><span class="pre">None</span></code> diberikan)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="s-internationalization-tags-and-filters">
<span id="internationalization-tags-and-filters"></span><h2>Internationalization tags and filters<a class="headerlink" href="#internationalization-tags-and-filters" title="Link permanen untuk headline ini">¶</a></h2>
<p>Django provides template tags and filters to control each aspect of
<a class="reference internal" href="../../topics/i18n/index.html"><span class="doc">internationalization</span></a> in templates. They allow for
granular control of translations, formatting, and time zone conversions.</p>
<div class="section" id="s-i18n">
<span id="i18n"></span><h3><code class="docutils literal notranslate"><span class="pre">i18n</span></code><a class="headerlink" href="#i18n" title="Link permanen untuk headline ini">¶</a></h3>
<p>This library allows specifying translatable text in templates.
To enable it, set <a class="reference internal" href="../settings.html#std:setting-USE_I18N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_I18N</span></code></a> to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then load it with
<code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">i18n</span> <span class="pre">%}</span></code>.</p>
<p>Lihat <a class="reference internal" href="../../topics/i18n/translation.html#specifying-translation-strings-in-template-code"><span class="std std-ref">Internasionalisasi: dalam kode cetakan</span></a>.</p>
</div>
<div class="section" id="s-l10n">
<span id="l10n"></span><h3><code class="docutils literal notranslate"><span class="pre">l10n</span></code><a class="headerlink" href="#l10n" title="Link permanen untuk headline ini">¶</a></h3>
<p>This library provides control over the localization of values in templates.
You only need to load the library using <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">l10n</span> <span class="pre">%}</span></code>, but you'll often
set <a class="reference internal" href="../settings.html#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> to <code class="docutils literal notranslate"><span class="pre">True</span></code> so that localization is active by default.</p>
<p>Lihat <a class="reference internal" href="../../topics/i18n/formatting.html#topic-l10n-templates"><span class="std std-ref">Mengendalikan lokalisasi dalam cetakan-cetakan</span></a>.</p>
</div>
<div class="section" id="s-tz">
<span id="tz"></span><h3><code class="docutils literal notranslate"><span class="pre">tz</span></code><a class="headerlink" href="#tz" title="Link permanen untuk headline ini">¶</a></h3>
<p>This library provides control over time zone conversions in templates.
Like <code class="docutils literal notranslate"><span class="pre">l10n</span></code>, you only need to load the library using <code class="docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">tz</span> <span class="pre">%}</span></code>,
but you'll usually also set <a class="reference internal" href="../settings.html#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> to <code class="docutils literal notranslate"><span class="pre">True</span></code> so that conversion
to local time happens by default.</p>
<p>Lihat <a class="reference internal" href="../../topics/i18n/timezones.html#time-zones-in-templates"><span class="std std-ref">Time zone aware output in templates</span></a>.</p>
</div>
</div>
<div class="section" id="s-other-tags-and-filters-libraries">
<span id="other-tags-and-filters-libraries"></span><h2>Other tags and filters libraries<a class="headerlink" href="#other-tags-and-filters-libraries" title="Link permanen untuk headline ini">¶</a></h2>
<p>Django comes with a couple of other template-tag libraries that you have to
enable explicitly in your <a class="reference internal" href="../settings.html#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> setting and enable in your
template with the <a class="reference internal" href="#std:templatetag-load"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">%}</span></code></a> tag.</p>
<div class="section" id="s-django-contrib-humanize">
<span id="django-contrib-humanize"></span><h3><code class="docutils literal notranslate"><span class="pre">django.contrib.humanize</span></code><a class="headerlink" href="#django-contrib-humanize" title="Link permanen untuk headline ini">¶</a></h3>
<p>A set of Django template filters useful for adding a &quot;human touch&quot; to data. See
<a class="reference internal" href="../contrib/humanize.html"><span class="doc">django.contrib.humanize</span></a>.</p>
</div>
<div class="section" id="s-static">
<span id="static"></span><h3><code class="docutils literal notranslate"><span class="pre">static</span></code><a class="headerlink" href="#static" title="Link permanen untuk headline ini">¶</a></h3>
<div class="section" id="s-std:templatetag-static">
<span id="s-id6"></span><span id="std:templatetag-static"></span><span id="id6"></span><h4><code class="docutils literal notranslate"><span class="pre">static</span></code><a class="headerlink" href="#std:templatetag-static" title="Link permanen untuk headline ini">¶</a></h4>
<p>To link to static files that are saved in <a class="reference internal" href="../settings.html#std:setting-STATIC_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a> Django ships
with a <a class="reference internal" href="#std:templatetag-static"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">static</span></code></a> template tag. If the <a class="reference internal" href="../contrib/staticfiles.html#module-django.contrib.staticfiles" title="django.contrib.staticfiles: An app for handling static files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code></a>
app is installed, the tag will serve files using <code class="docutils literal notranslate"><span class="pre">url()</span></code> method of the
storage specified by <a class="reference internal" href="../settings.html#std:setting-STATICFILES_STORAGE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATICFILES_STORAGE</span></code></a>. For example:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">static</span> <span class="s2">&quot;images/hi.jpg&quot;</span> <span class="cp">%}</span><span class="s">&quot;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&quot;Hi!&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>It is also able to consume standard context variables, e.g. assuming a
<code class="docutils literal notranslate"><span class="pre">user_stylesheet</span></code> variable is passed to the template:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">static</span> <span class="nv">user_stylesheet</span> <span class="cp">%}</span><span class="s">&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/css&quot;</span> <span class="na">media</span><span class="o">=</span><span class="s">&quot;screen&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>If you'd like to retrieve a static URL without displaying it, you can use a
slightly different call:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">static</span> <span class="s2">&quot;images/hi.jpg&quot;</span> <span class="k">as</span> <span class="nv">myphoto</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">myphoto</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<div class="admonition-using-jinja2-templates admonition">
<p class="first admonition-title">Menggunakan cetakan Jinja2?</p>
<p class="last">See <a class="reference internal" href="../../topics/templates.html#django.template.backends.jinja2.Jinja2" title="django.template.backends.jinja2.Jinja2"><code class="xref py py-class docutils literal notranslate"><span class="pre">Jinja2</span></code></a> for information on
using the <code class="docutils literal notranslate"><span class="pre">static</span></code> tag with Jinja2.</p>
</div>
</div>
<div class="section" id="s-get-static-prefix">
<span id="s-std:templatetag-get_static_prefix"></span><span id="get-static-prefix"></span><span id="std:templatetag-get_static_prefix"></span><h4><code class="docutils literal notranslate"><span class="pre">get_static_prefix</span></code><a class="headerlink" href="#get-static-prefix" title="Link permanen untuk headline ini">¶</a></h4>
<p>You should prefer the <a class="reference internal" href="#std:templatetag-static"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">static</span></code></a> template tag, but if you need more control
over exactly where and how <a class="reference internal" href="../settings.html#std:setting-STATIC_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_URL</span></code></a> is injected into the template,
you can use the <a class="reference internal" href="#std:templatetag-get_static_prefix"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">get_static_prefix</span></code></a> template tag:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">get_static_prefix</span> <span class="cp">%}</span><span class="s">images/hi.jpg&quot;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&quot;Hi!&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>There's also a second form you can use to avoid extra processing if you need
the value multiple times:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">get_static_prefix</span> <span class="k">as</span> <span class="nv">STATIC_PREFIX</span> <span class="cp">%}</span>

<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">STATIC_PREFIX</span> <span class="cp">}}</span><span class="s">images/hi.jpg&quot;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&quot;Hi!&quot;</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">STATIC_PREFIX</span> <span class="cp">}}</span><span class="s">images/hi2.jpg&quot;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&quot;Hello!&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="s-get-media-prefix">
<span id="s-std:templatetag-get_media_prefix"></span><span id="get-media-prefix"></span><span id="std:templatetag-get_media_prefix"></span><h4><code class="docutils literal notranslate"><span class="pre">get_media_prefix</span></code><a class="headerlink" href="#get-media-prefix" title="Link permanen untuk headline ini">¶</a></h4>
<p>Similar to the <a class="reference internal" href="#std:templatetag-get_static_prefix"><code class="xref std std-ttag docutils literal notranslate"><span class="pre">get_static_prefix</span></code></a>, <code class="docutils literal notranslate"><span class="pre">get_media_prefix</span></code> populates a
template variable with the media prefix <a class="reference internal" href="../settings.html#std:setting-MEDIA_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_URL</span></code></a>, e.g.:</p>
<div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="cp">{%</span> <span class="k">load</span> <span class="nv">static</span> <span class="cp">%}</span>
<span class="p">&lt;</span><span class="nt">body</span> <span class="na">data-media-url</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{%</span> <span class="k">get_media_prefix</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
</pre></div>
</div>
<p>By storing the value in a data attribute, we ensure it's escaped appropriately
if we want to use it in a JavaScript context.</p>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Etiket cetakan dan penyaring siap-pakai</a><ul>
<li><a class="reference internal" href="#built-in-tag-reference">Acuan etiket siap-pakai</a><ul>
<li><a class="reference internal" href="#autoescape"><code class="docutils literal notranslate"><span class="pre">autoescape</span></code></a></li>
<li><a class="reference internal" href="#block"><code class="docutils literal notranslate"><span class="pre">block</span></code></a></li>
<li><a class="reference internal" href="#comment"><code class="docutils literal notranslate"><span class="pre">comment</span></code></a></li>
<li><a class="reference internal" href="#csrf-token"><code class="docutils literal notranslate"><span class="pre">csrf_token</span></code></a></li>
<li><a class="reference internal" href="#cycle"><code class="docutils literal notranslate"><span class="pre">cycle</span></code></a></li>
<li><a class="reference internal" href="#debug"><code class="docutils literal notranslate"><span class="pre">debug</span></code></a></li>
<li><a class="reference internal" href="#extends"><code class="docutils literal notranslate"><span class="pre">extends</span></code></a></li>
<li><a class="reference internal" href="#filter"><code class="docutils literal notranslate"><span class="pre">filter</span></code></a></li>
<li><a class="reference internal" href="#firstof"><code class="docutils literal notranslate"><span class="pre">firstof</span></code></a></li>
<li><a class="reference internal" href="#for"><code class="docutils literal notranslate"><span class="pre">for</span></code></a></li>
<li><a class="reference internal" href="#for-empty"><code class="docutils literal notranslate"><span class="pre">for</span></code> ... <code class="docutils literal notranslate"><span class="pre">empty</span></code></a></li>
<li><a class="reference internal" href="#if"><code class="docutils literal notranslate"><span class="pre">if</span></code></a><ul>
<li><a class="reference internal" href="#boolean-operators">Penghubung Boolean</a><ul>
<li><a class="reference internal" href="#operator">Penghubung <code class="docutils literal notranslate"><span class="pre">==</span></code></a></li>
<li><a class="reference internal" href="#id1">Penghubung <code class="docutils literal notranslate"><span class="pre">!=</span></code></a></li>
<li><a class="reference internal" href="#id2">Penghubung <code class="docutils literal notranslate"><span class="pre">&lt;</span></code></a></li>
<li><a class="reference internal" href="#id3">Penghubung <code class="docutils literal notranslate"><span class="pre">&gt;</span></code></a></li>
<li><a class="reference internal" href="#id4">Penghubung <code class="docutils literal notranslate"><span class="pre">&lt;=</span></code></a></li>
<li><a class="reference internal" href="#id5">Penghubung <code class="docutils literal notranslate"><span class="pre">&gt;=</span></code></a></li>
<li><a class="reference internal" href="#in-operator">Penghubung <code class="docutils literal notranslate"><span class="pre">in</span></code></a></li>
<li><a class="reference internal" href="#not-in-operator">Penghubung <code class="docutils literal notranslate"><span class="pre">not</span> <span class="pre">in</span></code></a></li>
<li><a class="reference internal" href="#is-operator">penghubung <code class="docutils literal notranslate"><span class="pre">is</span></code></a></li>
<li><a class="reference internal" href="#is-not-operator">penghubung <code class="docutils literal notranslate"><span class="pre">is</span> <span class="pre">not</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#filters">Filter</a></li>
<li><a class="reference internal" href="#complex-expressions">Pernyataan rumit</a></li>
</ul>
</li>
<li><a class="reference internal" href="#ifequal-and-ifnotequal"><code class="docutils literal notranslate"><span class="pre">ifequal</span></code> dan <code class="docutils literal notranslate"><span class="pre">ifnotequal</span></code></a></li>
<li><a class="reference internal" href="#ifchanged"><code class="docutils literal notranslate"><span class="pre">ifchanged</span></code></a></li>
<li><a class="reference internal" href="#include"><code class="docutils literal notranslate"><span class="pre">include</span></code></a></li>
<li><a class="reference internal" href="#load"><code class="docutils literal notranslate"><span class="pre">load</span></code></a></li>
<li><a class="reference internal" href="#lorem"><code class="docutils literal notranslate"><span class="pre">lorem</span></code></a></li>
<li><a class="reference internal" href="#now"><code class="docutils literal notranslate"><span class="pre">now</span></code></a></li>
<li><a class="reference internal" href="#regroup"><code class="docutils literal notranslate"><span class="pre">regroup</span></code></a><ul>
<li><a class="reference internal" href="#grouping-on-other-properties">Mengkelompokkan pada sifat lain</a></li>
</ul>
</li>
<li><a class="reference internal" href="#resetcycle"><code class="docutils literal notranslate"><span class="pre">resetcycle</span></code></a></li>
<li><a class="reference internal" href="#spaceless"><code class="docutils literal notranslate"><span class="pre">spaceless</span></code></a></li>
<li><a class="reference internal" href="#templatetag"><code class="docutils literal notranslate"><span class="pre">templatetag</span></code></a></li>
<li><a class="reference internal" href="#url"><code class="docutils literal notranslate"><span class="pre">url</span></code></a></li>
<li><a class="reference internal" href="#verbatim"><code class="docutils literal notranslate"><span class="pre">verbatim</span></code></a></li>
<li><a class="reference internal" href="#widthratio"><code class="docutils literal notranslate"><span class="pre">widthratio</span></code></a></li>
<li><a class="reference internal" href="#with"><code class="docutils literal notranslate"><span class="pre">with</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#built-in-filter-reference">Petunjuk penyaring siap-pakai</a><ul>
<li><a class="reference internal" href="#add"><code class="docutils literal notranslate"><span class="pre">add</span></code></a></li>
<li><a class="reference internal" href="#addslashes"><code class="docutils literal notranslate"><span class="pre">addslashes</span></code></a></li>
<li><a class="reference internal" href="#capfirst"><code class="docutils literal notranslate"><span class="pre">capfirst</span></code></a></li>
<li><a class="reference internal" href="#center"><code class="docutils literal notranslate"><span class="pre">center</span></code></a></li>
<li><a class="reference internal" href="#cut"><code class="docutils literal notranslate"><span class="pre">cut</span></code></a></li>
<li><a class="reference internal" href="#date"><code class="docutils literal notranslate"><span class="pre">date</span></code></a></li>
<li><a class="reference internal" href="#default"><code class="docutils literal notranslate"><span class="pre">default</span></code></a></li>
<li><a class="reference internal" href="#default-if-none"><code class="docutils literal notranslate"><span class="pre">default_if_none</span></code></a></li>
<li><a class="reference internal" href="#dictsort"><code class="docutils literal notranslate"><span class="pre">dictsort</span></code></a></li>
<li><a class="reference internal" href="#dictsortreversed"><code class="docutils literal notranslate"><span class="pre">dictsortreversed</span></code></a></li>
<li><a class="reference internal" href="#divisibleby"><code class="docutils literal notranslate"><span class="pre">divisibleby</span></code></a></li>
<li><a class="reference internal" href="#escape"><code class="docutils literal notranslate"><span class="pre">escape</span></code></a></li>
<li><a class="reference internal" href="#escapejs"><code class="docutils literal notranslate"><span class="pre">escapejs</span></code></a></li>
<li><a class="reference internal" href="#filesizeformat"><code class="docutils literal notranslate"><span class="pre">filesizeformat</span></code></a></li>
<li><a class="reference internal" href="#first"><code class="docutils literal notranslate"><span class="pre">first</span></code></a></li>
<li><a class="reference internal" href="#floatformat"><code class="docutils literal notranslate"><span class="pre">floatformat</span></code></a></li>
<li><a class="reference internal" href="#force-escape"><code class="docutils literal notranslate"><span class="pre">force_escape</span></code></a></li>
<li><a class="reference internal" href="#get-digit"><code class="docutils literal notranslate"><span class="pre">get_digit</span></code></a></li>
<li><a class="reference internal" href="#iriencode"><code class="docutils literal notranslate"><span class="pre">iriencode</span></code></a></li>
<li><a class="reference internal" href="#join"><code class="docutils literal notranslate"><span class="pre">join</span></code></a></li>
<li><a class="reference internal" href="#json-script"><code class="docutils literal notranslate"><span class="pre">json_script</span></code></a></li>
<li><a class="reference internal" href="#last"><code class="docutils literal notranslate"><span class="pre">last</span></code></a></li>
<li><a class="reference internal" href="#length"><code class="docutils literal notranslate"><span class="pre">length</span></code></a></li>
<li><a class="reference internal" href="#length-is"><code class="docutils literal notranslate"><span class="pre">length_is</span></code></a></li>
<li><a class="reference internal" href="#linebreaks"><code class="docutils literal notranslate"><span class="pre">linebreaks</span></code></a></li>
<li><a class="reference internal" href="#linebreaksbr"><code class="docutils literal notranslate"><span class="pre">linebreaksbr</span></code></a></li>
<li><a class="reference internal" href="#linenumbers"><code class="docutils literal notranslate"><span class="pre">linenumbers</span></code></a></li>
<li><a class="reference internal" href="#ljust"><code class="docutils literal notranslate"><span class="pre">ljust</span></code></a></li>
<li><a class="reference internal" href="#lower"><code class="docutils literal notranslate"><span class="pre">lower</span></code></a></li>
<li><a class="reference internal" href="#make-list"><code class="docutils literal notranslate"><span class="pre">make_list</span></code></a></li>
<li><a class="reference internal" href="#phone2numeric"><code class="docutils literal notranslate"><span class="pre">phone2numeric</span></code></a></li>
<li><a class="reference internal" href="#pluralize"><code class="docutils literal notranslate"><span class="pre">pluralize</span></code></a></li>
<li><a class="reference internal" href="#pprint"><code class="docutils literal notranslate"><span class="pre">pprint</span></code></a></li>
<li><a class="reference internal" href="#random"><code class="docutils literal notranslate"><span class="pre">random</span></code></a></li>
<li><a class="reference internal" href="#rjust"><code class="docutils literal notranslate"><span class="pre">rjust</span></code></a></li>
<li><a class="reference internal" href="#safe"><code class="docutils literal notranslate"><span class="pre">safe</span></code></a></li>
<li><a class="reference internal" href="#safeseq"><code class="docutils literal notranslate"><span class="pre">safeseq</span></code></a></li>
<li><a class="reference internal" href="#slice"><code class="docutils literal notranslate"><span class="pre">slice</span></code></a></li>
<li><a class="reference internal" href="#slugify"><code class="docutils literal notranslate"><span class="pre">slugify</span></code></a></li>
<li><a class="reference internal" href="#stringformat"><code class="docutils literal notranslate"><span class="pre">stringformat</span></code></a></li>
<li><a class="reference internal" href="#striptags"><code class="docutils literal notranslate"><span class="pre">striptags</span></code></a></li>
<li><a class="reference internal" href="#time"><code class="docutils literal notranslate"><span class="pre">time</span></code></a></li>
<li><a class="reference internal" href="#timesince"><code class="docutils literal notranslate"><span class="pre">timesince</span></code></a></li>
<li><a class="reference internal" href="#timeuntil"><code class="docutils literal notranslate"><span class="pre">timeuntil</span></code></a></li>
<li><a class="reference internal" href="#title"><code class="docutils literal notranslate"><span class="pre">title</span></code></a></li>
<li><a class="reference internal" href="#truncatechars"><code class="docutils literal notranslate"><span class="pre">truncatechars</span></code></a></li>
<li><a class="reference internal" href="#truncatechars-html"><code class="docutils literal notranslate"><span class="pre">truncatechars_html</span></code></a></li>
<li><a class="reference internal" href="#truncatewords"><code class="docutils literal notranslate"><span class="pre">truncatewords</span></code></a></li>
<li><a class="reference internal" href="#truncatewords-html"><code class="docutils literal notranslate"><span class="pre">truncatewords_html</span></code></a></li>
<li><a class="reference internal" href="#unordered-list"><code class="docutils literal notranslate"><span class="pre">unordered_list</span></code></a></li>
<li><a class="reference internal" href="#upper"><code class="docutils literal notranslate"><span class="pre">upper</span></code></a></li>
<li><a class="reference internal" href="#urlencode"><code class="docutils literal notranslate"><span class="pre">urlencode</span></code></a></li>
<li><a class="reference internal" href="#urlize"><code class="docutils literal notranslate"><span class="pre">urlize</span></code></a></li>
<li><a class="reference internal" href="#urlizetrunc"><code class="docutils literal notranslate"><span class="pre">urlizetrunc</span></code></a></li>
<li><a class="reference internal" href="#wordcount"><code class="docutils literal notranslate"><span class="pre">wordcount</span></code></a></li>
<li><a class="reference internal" href="#wordwrap"><code class="docutils literal notranslate"><span class="pre">wordwrap</span></code></a></li>
<li><a class="reference internal" href="#yesno"><code class="docutils literal notranslate"><span class="pre">yesno</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#internationalization-tags-and-filters">Internationalization tags and filters</a><ul>
<li><a class="reference internal" href="#i18n"><code class="docutils literal notranslate"><span class="pre">i18n</span></code></a></li>
<li><a class="reference internal" href="#l10n"><code class="docutils literal notranslate"><span class="pre">l10n</span></code></a></li>
<li><a class="reference internal" href="#tz"><code class="docutils literal notranslate"><span class="pre">tz</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#other-tags-and-filters-libraries">Other tags and filters libraries</a><ul>
<li><a class="reference internal" href="#django-contrib-humanize"><code class="docutils literal notranslate"><span class="pre">django.contrib.humanize</span></code></a></li>
<li><a class="reference internal" href="#static"><code class="docutils literal notranslate"><span class="pre">static</span></code></a><ul>
<li><a class="reference internal" href="#std:templatetag-static"><code class="docutils literal notranslate"><span class="pre">static</span></code></a></li>
<li><a class="reference internal" href="#get-static-prefix"><code class="docutils literal notranslate"><span class="pre">get_static_prefix</span></code></a></li>
<li><a class="reference internal" href="#get-media-prefix"><code class="docutils literal notranslate"><span class="pre">get_media_prefix</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Topik sebelum</h4>
  <p class="topless"><a href="language.html"
                        title="bab sebelum">Bahasa cetakan Django</a></p>
  <h4>Topik berikutnya</h4>
  <p class="topless"><a href="api.html"
                        title="bab berikutnya">Bahasa cetakan Django: untuk pemrogram Python</a></p>
  <div role="note" aria-label="source link">
    <h3>Halaman Ini</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/ref/templates/builtins.txt"
            rel="nofollow">Lihat Sumber</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Pencarian cepat</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Des 02, 2019</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="language.html" title="Bahasa cetakan Django">previous</a>
     |
    <a href="../index.html" title="Acuan API" accesskey="U">up</a>
   |
    <a href="api.html" title="Bahasa cetakan Django: untuk pemrogram Python">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>