Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed May 6, 2024
1 parent e4b7b70 commit 50d2ba4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
21 changes: 21 additions & 0 deletions _modules/apis_core/history/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,27 @@ <h1>Source code for apis_core.history.models</h1><div class="highlight"><pre>
<span class="k">def</span> <span class="nf">get_absolute_url</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">ct</span> <span class="o">=</span> <span class="n">ContentType</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get_for_model</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="k">return</span> <span class="n">reverse</span><span class="p">(</span><span class="s2">&quot;apis_core:generic:detail&quot;</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">[</span><span class="n">ct</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">history_id</span><span class="p">])</span></div>


<div class="viewcode-block" id="APISHistoryTableBase.get_diff">
<a class="viewcode-back" href="../../../modules/apis_core.history.html#apis_core.history.models.APISHistoryTableBase.get_diff">[docs]</a>
<span class="k">def</span> <span class="nf">get_diff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other_version</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">history_type</span> <span class="o">==</span> <span class="s2">&quot;-&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="n">version</span> <span class="o">=</span> <span class="n">other_version</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">prev_record</span>
<span class="k">if</span> <span class="n">version</span><span class="p">:</span>
<span class="n">delta</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">diff_against</span><span class="p">(</span><span class="n">version</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">delta</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">diff_against</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">())</span>
<span class="n">changes</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
<span class="nb">filter</span><span class="p">(</span>
<span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">new</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x</span><span class="o">.</span><span class="n">old</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span>
<span class="ow">and</span> <span class="n">x</span><span class="o">.</span><span class="n">field</span> <span class="o">!=</span> <span class="s2">&quot;id&quot;</span>
<span class="ow">and</span> <span class="ow">not</span> <span class="n">x</span><span class="o">.</span><span class="n">field</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;_ptr&quot;</span><span class="p">),</span>
<span class="n">delta</span><span class="o">.</span><span class="n">changes</span><span class="p">,</span>
<span class="p">)</span>
<span class="p">)</span>
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">changes</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">change</span><span class="p">:</span> <span class="n">change</span><span class="o">.</span><span class="n">field</span><span class="p">)</span></div>
</div>


Expand Down
12 changes: 1 addition & 11 deletions _modules/apis_core/history/serializers.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,9 @@ <h1>Source code for apis_core.history.serializers</h1><div class="highlight"><pr
<span class="k">def</span> <span class="nf">get_diff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
<span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">history_type</span> <span class="o">==</span> <span class="s2">&quot;-&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="k">if</span> <span class="n">obj</span><span class="o">.</span><span class="n">prev_record</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">diff</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">diff_against</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="vm">__class__</span><span class="p">())</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">diff</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">diff_against</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">prev_record</span><span class="p">)</span>
<span class="n">changed_fields</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">changes</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">change</span> <span class="ow">in</span> <span class="n">diff</span><span class="o">.</span><span class="n">changes</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span>
<span class="p">(</span><span class="n">change</span><span class="o">.</span><span class="n">new</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="ow">and</span> <span class="n">change</span><span class="o">.</span><span class="n">old</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">)</span>
<span class="ow">or</span> <span class="n">change</span><span class="o">.</span><span class="n">field</span> <span class="o">==</span> <span class="s2">&quot;id&quot;</span>
<span class="ow">or</span> <span class="n">change</span><span class="o">.</span><span class="n">field</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;_ptr&quot;</span><span class="p">)</span>
<span class="p">):</span>
<span class="k">continue</span>
<span class="k">for</span> <span class="n">change</span> <span class="ow">in</span> <span class="n">obj</span><span class="o">.</span><span class="n">get_diff</span><span class="p">():</span>
<span class="n">changed_fields</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">change</span><span class="o">.</span><span class="n">field</span><span class="p">)</span>
<span class="n">changes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ModelChangeSerializer</span><span class="p">(</span><span class="n">change</span><span class="p">,</span> <span class="n">obj</span><span class="p">)</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
<span class="k">return</span> <span class="p">{</span><span class="s2">&quot;changed_fields&quot;</span><span class="p">:</span> <span class="n">changed_fields</span><span class="p">,</span> <span class="s2">&quot;changes&quot;</span><span class="p">:</span> <span class="n">changes</span><span class="p">}</span></div>
Expand Down
10 changes: 7 additions & 3 deletions genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,12 @@ <h2 id="G">G</h2>
</li>
<li><a href="modules/apis_core.generic.html#apis_core.generic.abc.GenericModel.get_delete_url">get_delete_url() (apis_core.generic.abc.GenericModel method)</a>
</li>
<li><a href="modules/apis_core.history.html#apis_core.history.serializers.HistoryLogSerializer.get_diff">get_diff() (apis_core.history.serializers.HistoryLogSerializer method)</a>
<li><a href="modules/apis_core.history.html#apis_core.history.models.APISHistoryTableBase.get_diff">get_diff() (apis_core.history.models.APISHistoryTableBase method)</a>

<ul>
<li><a href="modules/apis_core.history.html#apis_core.history.serializers.HistoryLogSerializer.get_diff">(apis_core.history.serializers.HistoryLogSerializer method)</a>
</li>
</ul></li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.models.AbstractEntity.get_duplicate_url">get_duplicate_url() (apis_core.apis_entities.models.AbstractEntity method)</a>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.models.AbstractEntity.get_edit_url">get_edit_url() (apis_core.apis_entities.models.AbstractEntity method)</a>
Expand All @@ -1618,10 +1622,10 @@ <h2 id="G">G</h2>
<li><a href="modules/apis_core.generic.html#apis_core.generic.abc.GenericModel.get_edit_url">(apis_core.generic.abc.GenericModel method)</a>
</li>
</ul></li>
<li><a href="modules/apis_core.utils.html#apis_core.utils.caching.get_entity_class_of_name">get_entity_class_of_name() (in module apis_core.utils.caching)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/apis_core.utils.html#apis_core.utils.caching.get_entity_class_of_name">get_entity_class_of_name() (in module apis_core.utils.caching)</a>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.models.AbstractEntity.get_entity_list_filter">get_entity_list_filter() (apis_core.apis_entities.models.AbstractEntity class method)</a>
</li>
<li><a href="modules/apis_core.utils.html#apis_core.utils.settings.get_entity_settings_by_modelname">get_entity_settings_by_modelname() (in module apis_core.utils.settings)</a>
Expand Down
5 changes: 5 additions & 0 deletions modules/apis_core.history.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ <h2>Submodules<a class="headerlink" href="#submodules" title="Link to this headi
<span class="sig-name descname"><span class="pre">get_absolute_url</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/apis_core/history/models.html#APISHistoryTableBase.get_absolute_url"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apis_core.history.models.APISHistoryTableBase.get_absolute_url" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="apis_core.history.models.APISHistoryTableBase.get_diff">
<span class="sig-name descname"><span class="pre">get_diff</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other_version</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/apis_core/history/models.html#APISHistoryTableBase.get_diff"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apis_core.history.models.APISHistoryTableBase.get_diff" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="apis_core.history.models.APISHistoryTableBase.get_triples_for_version">
<span class="sig-name descname"><span class="pre">get_triples_for_version</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">only_latest</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">history_date</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">datetime</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filter_for_triples</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/apis_core/history/models.html#APISHistoryTableBase.get_triples_for_version"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apis_core.history.models.APISHistoryTableBase.get_triples_for_version" title="Link to this definition"></a></dt>
Expand Down
1 change: 1 addition & 0 deletions modules/apis_core.html
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ <h2>Subpackages<a class="headerlink" href="#subpackages" title="Link to this hea
<li class="toctree-l3"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase</span></code></a><ul>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.Meta"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.Meta</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.get_absolute_url"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.get_absolute_url()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.get_diff"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.get_diff()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.get_triples_for_version"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.get_triples_for_version()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.set_version_tag"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.set_version_tag()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="apis_core.history.html#apis_core.history.models.APISHistoryTableBase.version_tag"><code class="docutils literal notranslate"><span class="pre">APISHistoryTableBase.version_tag</span></code></a></li>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 50d2ba4

Please sign in to comment.