/usr/share/doc/python-django-modeltranslation/html/commands.html is in python-django-modeltranslation-doc 0.12.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | <!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Management Commands — django-modeltranslation 0.12.2 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.12.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</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>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Caveats" href="caveats.html" />
<link rel="prev" title="Django Admin Integration" href="admin.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="caveats.html" title="Caveats"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="admin.html" title="Django Admin Integration"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">django-modeltranslation 0.12.2 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="management-commands">
<span id="commands"></span><h1>Management Commands<a class="headerlink" href="#management-commands" title="Permalink to this headline">¶</a></h1>
<div class="section" id="the-update-translation-fields-command">
<span id="commands-update-translation-fields"></span><h2>The <code class="docutils literal"><span class="pre">update_translation_fields</span></code> Command<a class="headerlink" href="#the-update-translation-fields-command" title="Permalink to this headline">¶</a></h2>
<p>In case modeltranslation was installed in an existing project and you
have specified to translate fields of models which are already synced to the
database, you have to update your database schema (see <a class="reference internal" href="registration.html#db-fields"><span class="std std-ref">Committing fields to database</span></a>).</p>
<p>Unfortunately the newly added translation fields on the model will be empty
then, and your templates will show the translated value of the fields (see
<a class="reference internal" href="usage.html#rules"><span class="std std-ref">Rule 1</span></a>) which will be empty in this case. To correctly initialize
the default translation field you can use the <code class="docutils literal"><span class="pre">update_translation_fields</span></code>
command:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> python manage.py update_translation_fields
</pre></div>
</div>
<p>Taken the news example used throughout the documentation this command will copy
the value from the news object’s <code class="docutils literal"><span class="pre">title</span></code> field to the default translation
field <code class="docutils literal"><span class="pre">title_de</span></code>. It only does so if the default translation field is empty
otherwise nothing is copied.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Unless you configured modeltranslation to
<a class="reference internal" href="installation.html#settings-modeltranslation-default-language"><span class="std std-ref">override the default language</span></a>
the command will examine your <code class="docutils literal"><span class="pre">settings.LANGUAGES</span></code> variable and the first
language declared there will be used as the default language.</p>
</div>
<p>All translated models (as specified in the translation files) from all apps will be
populated with initial data.</p>
</div>
<div class="section" id="the-sync-translation-fields-command">
<span id="commands-sync-translation-fields"></span><h2>The <code class="docutils literal"><span class="pre">sync_translation_fields</span></code> Command<a class="headerlink" href="#the-sync-translation-fields-command" title="Permalink to this headline">¶</a></h2>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.4.</span></p>
</div>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> python manage.py sync_translation_fields
</pre></div>
</div>
<p>This command compares the database and translated models definitions (finding new translation
fields) and provides SQL statements to alter tables. You should run this command after adding
a new language to your <code class="docutils literal"><span class="pre">settings.LANGUAGES</span></code> or a new field to the <code class="docutils literal"><span class="pre">TranslationOptions</span></code> of
a registered model.</p>
<p>However, if you are using South in your project, in most cases it’s recommended to use migration
instead of <code class="docutils literal"><span class="pre">sync_translation_fields</span></code>. See <a class="reference internal" href="registration.html#db-fields"><span class="std std-ref">Committing fields to database</span></a> for detailed info and use cases.</p>
</div>
<div class="section" id="the-loaddata-command">
<h2>The <code class="docutils literal"><span class="pre">loaddata</span></code> Command<a class="headerlink" href="#the-loaddata-command" title="Permalink to this headline">¶</a></h2>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
<p>An extended version of Django’s original <code class="docutils literal"><span class="pre">loaddata</span></code> command which adds an optional
<code class="docutils literal"><span class="pre">populate</span></code> keyword. If the keyword is specified, the normal loading command will be
run under the selected auto-population modes.</p>
<p>By default no auto-population is performed.</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> python manage.py loaddata --populate<span class="o">=</span>all fixtures.json
</pre></div>
</div>
<p>Allowed modes are listed <a class="reference internal" href="usage.html#auto-population-modes"><span class="std std-ref">here</span></a>. To choose <code class="docutils literal"><span class="pre">False</span></code>
(turn off auto-population) specify <code class="docutils literal"><span class="pre">'0'</span></code> or <code class="docutils literal"><span class="pre">'false'</span></code>:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> python manage.py loaddata --populate<span class="o">=</span><span class="nb">false</span> fixtures.json
<span class="gp">$</span> python manage.py loaddata --populate<span class="o">=</span><span class="m">0</span> fixtures.json
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If <code class="docutils literal"><span class="pre">populate</span></code> is not specified, the current auto-population mode is used. <em>Current</em> means
the one set by <a class="reference internal" href="installation.html#settings-modeltranslation-auto-populate"><span class="std std-ref">settings</span></a>.</p>
</div>
<p>Moreover, this <code class="docutils literal"><span class="pre">loaddata</span></code> command version can override the nasty habit of changing locale to
<cite>en-us</cite>. By default, it will retain the proper locale. To get the old behaviour back, set
<a class="reference internal" href="installation.html#settings-modeltranslation-loaddata-retain-locale"><span class="std std-ref">MODELTRANSLATION_LOADDATA_RETAIN_LOCALE</span></a> to <code class="docutils literal"><span class="pre">False</span></code>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Management Commands</a><ul>
<li><a class="reference internal" href="#the-update-translation-fields-command">The <code class="docutils literal"><span class="pre">update_translation_fields</span></code> Command</a></li>
<li><a class="reference internal" href="#the-sync-translation-fields-command">The <code class="docutils literal"><span class="pre">sync_translation_fields</span></code> Command</a></li>
<li><a class="reference internal" href="#the-loaddata-command">The <code class="docutils literal"><span class="pre">loaddata</span></code> Command</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="admin.html"
title="previous chapter">Django Admin Integration</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="caveats.html"
title="next chapter">Caveats</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/commands.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="caveats.html" title="Caveats"
>next</a> |</li>
<li class="right" >
<a href="admin.html" title="Django Admin Integration"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">django-modeltranslation 0.12.2 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, Peter Eschler, Dirk Eschler, Jacek Tomaszewski.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>
|