Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Apr 2, 2024
1 parent b8c722e commit 660cccc
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 93 deletions.
15 changes: 3 additions & 12 deletions _modules/apis_core/apis_entities/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
<div itemprop="articleBody">

<h1>Source code for apis_core.apis_entities.tables</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">apis_core.generic.helpers</span> <span class="kn">import</span> <span class="n">permission_fullname</span>
<span class="kn">from</span> <span class="nn">apis_core.generic.tables</span> <span class="kn">import</span> <span class="n">GenericTable</span><span class="p">,</span> <span class="n">ActionColumn</span>
<span></span><span class="kn">from</span> <span class="nn">apis_core.generic.tables</span> <span class="kn">import</span> <span class="n">GenericTable</span><span class="p">,</span> <span class="n">ActionColumn</span>


<div class="viewcode-block" id="DuplicateColumn">
Expand All @@ -101,7 +100,8 @@ <h1>Source code for apis_core.apis_entities.tables</h1><div class="highlight"><p
<span class="sd"> A column showing a view button</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/duplicate.html&quot;</span></div>
<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/duplicate.html&quot;</span>
<span class="n">permission</span> <span class="o">=</span> <span class="s2">&quot;create&quot;</span></div>



Expand All @@ -114,15 +114,6 @@ <h1>Source code for apis_core.apis_entities.tables</h1><div class="highlight"><p
<a class="viewcode-back" href="../../../modules/apis_core.apis_entities.html#apis_core.apis_entities.tables.AbstractEntityTable.Meta">[docs]</a>
<span class="k">class</span> <span class="nc">Meta</span><span class="p">(</span><span class="n">GenericTable</span><span class="o">.</span><span class="n">Meta</span><span class="p">):</span>
<span class="n">sequence</span> <span class="o">=</span> <span class="p">(</span><span class="s2">&quot;...&quot;</span><span class="p">,</span> <span class="s2">&quot;view&quot;</span><span class="p">,</span> <span class="s2">&quot;edit&quot;</span><span class="p">,</span> <span class="s2">&quot;delete&quot;</span><span class="p">,</span> <span class="s2">&quot;noduplicate&quot;</span><span class="p">)</span></div>


<div class="viewcode-block" id="AbstractEntityTable.before_render">
<a class="viewcode-back" href="../../../modules/apis_core.apis_entities.html#apis_core.apis_entities.tables.AbstractEntityTable.before_render">[docs]</a>
<span class="k">def</span> <span class="nf">before_render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">before_render</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
<span class="k">if</span> <span class="n">model</span> <span class="o">:=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Meta</span><span class="p">,</span> <span class="s2">&quot;model&quot;</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">has_perm</span><span class="p">(</span><span class="n">permission_fullname</span><span class="p">(</span><span class="s2">&quot;create&quot;</span><span class="p">,</span> <span class="n">model</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">hide</span><span class="p">(</span><span class="s2">&quot;noduplicate&quot;</span><span class="p">)</span></div>
</div>

</pre></div>
Expand Down
34 changes: 18 additions & 16 deletions _modules/apis_core/generic/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,18 @@ <h1>Source code for apis_core.generic.tables</h1><div class="highlight"><pre>
<span class="n">orderable</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">exclude_from_export</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">verbose_name</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">attrs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;td&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;style&quot;</span><span class="p">:</span> <span class="s2">&quot;width:1%;&quot;</span><span class="p">}}</span></div>
<span class="n">attrs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;td&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;style&quot;</span><span class="p">:</span> <span class="s2">&quot;width:1%;&quot;</span><span class="p">}}</span>

<div class="viewcode-block" id="ActionColumn.render">
<a class="viewcode-back" href="../../../modules/apis_core.generic.html#apis_core.generic.tables.ActionColumn.render">[docs]</a>
<span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">record</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="n">permission</span> <span class="o">:=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">&quot;permission&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="o">.</span><span class="n">context</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">has_perm</span><span class="p">(</span>
<span class="n">permission_fullname</span><span class="p">(</span><span class="n">permission</span><span class="p">,</span> <span class="n">record</span><span class="p">)</span>
<span class="p">):</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span>
<span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">record</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div>
</div>



Expand All @@ -143,7 +154,8 @@ <h1>Source code for apis_core.generic.tables</h1><div class="highlight"><pre>
<span class="sd"> A column showing a delete button</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/delete.html&quot;</span></div>
<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/delete.html&quot;</span>
<span class="n">permission</span> <span class="o">=</span> <span class="s2">&quot;delete&quot;</span></div>



Expand All @@ -154,7 +166,8 @@ <h1>Source code for apis_core.generic.tables</h1><div class="highlight"><pre>
<span class="sd"> A column showing an edit button</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/edit.html&quot;</span></div>
<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/edit.html&quot;</span>
<span class="n">permission</span> <span class="o">=</span> <span class="s2">&quot;change&quot;</span></div>



Expand All @@ -165,7 +178,8 @@ <h1>Source code for apis_core.generic.tables</h1><div class="highlight"><pre>
<span class="sd"> A column showing a view button</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/view.html&quot;</span></div>
<span class="n">template_name</span> <span class="o">=</span> <span class="s2">&quot;columns/view.html&quot;</span>
<span class="n">permission</span> <span class="o">=</span> <span class="s2">&quot;view&quot;</span></div>



Expand Down Expand Up @@ -199,18 +213,6 @@ <h1>Source code for apis_core.generic.tables</h1><div class="highlight"><pre>
<span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
<span class="n">fields</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;id&quot;</span><span class="p">,</span> <span class="s2">&quot;desc&quot;</span><span class="p">]</span>
<span class="n">sequence</span> <span class="o">=</span> <span class="p">(</span><span class="s2">&quot;...&quot;</span><span class="p">,</span> <span class="s2">&quot;view&quot;</span><span class="p">,</span> <span class="s2">&quot;edit&quot;</span><span class="p">,</span> <span class="s2">&quot;delete&quot;</span><span class="p">)</span></div>


<div class="viewcode-block" id="GenericTable.before_render">
<a class="viewcode-back" href="../../../modules/apis_core.generic.html#apis_core.generic.tables.GenericTable.before_render">[docs]</a>
<span class="k">def</span> <span class="nf">before_render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
<span class="k">if</span> <span class="n">model</span> <span class="o">:=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Meta</span><span class="p">,</span> <span class="s2">&quot;model&quot;</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">has_perm</span><span class="p">(</span><span class="n">permission_fullname</span><span class="p">(</span><span class="s2">&quot;delete&quot;</span><span class="p">,</span> <span class="n">model</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">hide</span><span class="p">(</span><span class="s2">&quot;delete&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">has_perm</span><span class="p">(</span><span class="n">permission_fullname</span><span class="p">(</span><span class="s2">&quot;change&quot;</span><span class="p">,</span> <span class="n">model</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">hide</span><span class="p">(</span><span class="s2">&quot;edit&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">has_perm</span><span class="p">(</span><span class="n">permission_fullname</span><span class="p">(</span><span class="s2">&quot;view&quot;</span><span class="p">,</span> <span class="n">model</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">hide</span><span class="p">(</span><span class="s2">&quot;view&quot;</span><span class="p">)</span></div>
</div>

</pre></div>
Expand Down
22 changes: 14 additions & 8 deletions genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -964,12 +964,6 @@ <h2 id="B">B</h2>
</ul></li>
<li><a href="modules/apis_core.apis_relations.html#apis_core.apis_relations.models.BaseRelationManager">BaseRelationManager (class in apis_core.apis_relations.models)</a>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.tables.AbstractEntityTable.before_render">before_render() (apis_core.apis_entities.tables.AbstractEntityTable method)</a>

<ul>
<li><a href="modules/apis_core.generic.html#apis_core.generic.tables.GenericTable.before_render">(apis_core.generic.tables.GenericTable method)</a>
</li>
</ul></li>
</ul></td>
</tr></table>

Expand Down Expand Up @@ -2425,6 +2419,16 @@ <h2 id="P">P</h2>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.api_views.ResolveAbbreviations.parser_classes">parser_classes (apis_core.apis_entities.api_views.ResolveAbbreviations attribute)</a>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.tables.DuplicateColumn.permission">permission (apis_core.apis_entities.tables.DuplicateColumn attribute)</a>

<ul>
<li><a href="modules/apis_core.generic.html#apis_core.generic.tables.DeleteColumn.permission">(apis_core.generic.tables.DeleteColumn attribute)</a>
</li>
<li><a href="modules/apis_core.generic.html#apis_core.generic.tables.EditColumn.permission">(apis_core.generic.tables.EditColumn attribute)</a>
</li>
<li><a href="modules/apis_core.generic.html#apis_core.generic.tables.ViewColumn.permission">(apis_core.generic.tables.ViewColumn attribute)</a>
</li>
</ul></li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.views.EntitiesDuplicate.permission_action_required">permission_action_required (apis_core.apis_entities.views.EntitiesDuplicate attribute)</a>

<ul>
Expand All @@ -2449,12 +2453,12 @@ <h2 id="P">P</h2>
</li>
<li><a href="modules/apis_core.apis_entities.html#apis_core.apis_entities.test_models.PermissionsModelTestCase">PermissionsModelTestCase (class in apis_core.apis_entities.test_models)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/apis_core.utils.html#apis_core.utils.test_rdf.Person">Person (class in apis_core.utils.test_rdf)</a>
</li>
<li><a href="modules/apis_core.utils.html#apis_core.utils.test_rdf.Person.DoesNotExist">Person.DoesNotExist</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/apis_core.utils.html#apis_core.utils.test_rdf.Person.MultipleObjectsReturned">Person.MultipleObjectsReturned</a>
</li>
<li><a href="modules/apis_core.utils.html#apis_core.utils.test_rdf.Place">Place (class in apis_core.utils.test_rdf)</a>
Expand Down Expand Up @@ -2569,6 +2573,8 @@ <h2 id="R">R</h2>
<li><a href="modules/apis_core.apis_metainfo.html#apis_core.apis_metainfo.api_renderers.PaginatedCSVRenderer.render">(apis_core.apis_metainfo.api_renderers.PaginatedCSVRenderer method)</a>
</li>
<li><a href="modules/apis_core.apis_metainfo.html#apis_core.apis_metainfo.api_renderers.TEIBaseRenderer.render">(apis_core.apis_metainfo.api_renderers.TEIBaseRenderer method)</a>
</li>
<li><a href="modules/apis_core.generic.html#apis_core.generic.tables.ActionColumn.render">(apis_core.generic.tables.ActionColumn method)</a>
</li>
</ul></li>
</ul></td>
Expand Down
Loading

0 comments on commit 660cccc

Please sign in to comment.