Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 14, 2023
1 parent 0ebb458 commit d106664
Show file tree
Hide file tree
Showing 27 changed files with 22 additions and 2,173 deletions.
15 changes: 0 additions & 15 deletions _modules/apis_core/apis_entities/detail_generic.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ <h1>Source code for apis_core.apis_entities.detail_generic</h1><div class="highl
<span class="kn">from</span> <span class="nn">django_tables2</span> <span class="kn">import</span> <span class="n">RequestConfig</span>
<span class="kn">from</span> <span class="nn">django.forms.models</span> <span class="kn">import</span> <span class="n">model_to_dict</span>

<span class="kn">from</span> <span class="nn">apis_core.apis_labels.models</span> <span class="kn">import</span> <span class="n">Label</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_metainfo.models</span> <span class="kn">import</span> <span class="n">Uri</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_relations.tables</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">get_generic_triple_table</span><span class="p">,</span>
<span class="n">LabelTableBase</span><span class="p">,</span>
<span class="p">)</span>
<span class="kn">from</span> <span class="nn">apis_core.utils.utils</span> <span class="kn">import</span> <span class="n">access_for_all</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_relations.models</span> <span class="kn">import</span> <span class="n">TempTriple</span>
Expand Down Expand Up @@ -164,11 +162,6 @@ <h1>Source code for apis_core.apis_entities.detail_generic</h1><div class="highl

<span class="c1"># TODO RDF : Check / Adapt the following code to rdf architecture</span>
<span class="n">object_lod</span> <span class="o">=</span> <span class="n">Uri</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">root_object</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">instance</span><span class="p">)</span>
<span class="n">object_labels</span> <span class="o">=</span> <span class="n">Label</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">temp_entity__id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">instance</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
<span class="n">tb_label</span> <span class="o">=</span> <span class="n">LabelTableBase</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">object_labels</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="n">entity</span><span class="o">.</span><span class="n">title</span><span class="p">()[:</span><span class="mi">2</span><span class="p">]</span> <span class="o">+</span> <span class="s2">&quot;L-&quot;</span><span class="p">)</span>
<span class="n">tb_label_open</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;PL-page&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="n">side_bar</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">&quot;Label&quot;</span><span class="p">,</span> <span class="n">tb_label</span><span class="p">,</span> <span class="s2">&quot;PersonLabel&quot;</span><span class="p">,</span> <span class="n">tb_label_open</span><span class="p">))</span>
<span class="n">RequestConfig</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">paginate</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;per_page&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">})</span><span class="o">.</span><span class="n">configure</span><span class="p">(</span><span class="n">tb_label</span><span class="p">)</span>
<span class="n">template</span> <span class="o">=</span> <span class="n">select_template</span><span class="p">(</span>
<span class="p">[</span>
<span class="s2">&quot;apis_entities/detail_views/</span><span class="si">{}</span><span class="s2">_detail_generic.html&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">entity</span><span class="p">),</span>
Expand All @@ -195,12 +188,6 @@ <h1>Source code for apis_core.apis_entities.detail_generic</h1><div class="highl
<span class="n">iiif</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">iiif_server</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="s2">&quot;APIS_IIIF_SERVER&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="n">iiif_info_json</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">instance</span><span class="o">.</span><span class="n">name</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">no_merge_labels</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">x</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">object_labels</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">x</span><span class="o">.</span><span class="n">label_type</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;Legacy&quot;</span><span class="p">)</span>
<span class="p">]</span>
<span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
<span class="n">no_merge_labels</span> <span class="o">=</span> <span class="p">[]</span>

<span class="n">relevant_fields</span> <span class="o">=</span> <span class="p">[]</span>
<span class="c1"># those are fields from TempEntityClass, this exclude list can be removed once TempEntityClass is dropped</span>
Expand Down Expand Up @@ -229,8 +216,6 @@ <h1>Source code for apis_core.apis_entities.detail_generic</h1><div class="highl
<span class="s2">&quot;object&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">instance</span><span class="p">,</span>
<span class="s2">&quot;relevant_fields&quot;</span><span class="p">:</span> <span class="n">relevant_fields</span><span class="p">,</span>
<span class="s2">&quot;right_card&quot;</span><span class="p">:</span> <span class="n">side_bar</span><span class="p">,</span>
<span class="s2">&quot;no_merge_labels&quot;</span><span class="p">:</span> <span class="n">no_merge_labels</span><span class="p">,</span>
<span class="s2">&quot;object_lables&quot;</span><span class="p">:</span> <span class="n">object_labels</span><span class="p">,</span>
<span class="s2">&quot;object_lod&quot;</span><span class="p">:</span> <span class="n">object_lod</span><span class="p">,</span>
<span class="s2">&quot;tei&quot;</span><span class="p">:</span> <span class="n">tei</span><span class="p">,</span>
<span class="s2">&quot;ceteicean_css&quot;</span><span class="p">:</span> <span class="n">ceteicean_css</span><span class="p">,</span>
Expand Down
8 changes: 1 addition & 7 deletions _modules/apis_core/apis_entities/edit_generic.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ <h1>Source code for apis_core.apis_entities.edit_generic</h1><div class="highlig
<span class="kn">from</span> <span class="nn">django.views</span> <span class="kn">import</span> <span class="n">View</span>
<span class="kn">from</span> <span class="nn">django.views.generic</span> <span class="kn">import</span> <span class="n">DeleteView</span>
<span class="kn">from</span> <span class="nn">django_tables2</span> <span class="kn">import</span> <span class="n">RequestConfig</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_labels.models</span> <span class="kn">import</span> <span class="n">Label</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_relations.models</span> <span class="kn">import</span> <span class="n">TempTriple</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_relations.tables</span> <span class="kn">import</span> <span class="n">get_generic_triple_table</span><span class="p">,</span> <span class="n">LabelTableEdit</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_relations.tables</span> <span class="kn">import</span> <span class="n">get_generic_triple_table</span>
<span class="kn">from</span> <span class="nn">.forms</span> <span class="kn">import</span> <span class="n">get_entities_form</span><span class="p">,</span> <span class="n">GenericEntitiesStanbolForm</span>
<span class="kn">from</span> <span class="nn">.views</span> <span class="kn">import</span> <span class="n">set_session_variables</span>
<span class="kn">from</span> <span class="nn">..apis_vocabularies.models</span> <span class="kn">import</span> <span class="n">TextType</span>
Expand Down Expand Up @@ -191,11 +190,6 @@ <h1>Source code for apis_core.apis_entities.edit_generic</h1><div class="highlig
<span class="n">apis_bibsonomy</span> <span class="o">=</span> <span class="s2">&quot;|&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">x</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">apis_bibsonomy</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">apis_bibsonomy</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">object_labels</span> <span class="o">=</span> <span class="n">Label</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">temp_entity__id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">instance</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
<span class="n">tb_label</span> <span class="o">=</span> <span class="n">LabelTableEdit</span><span class="p">(</span>
<span class="n">data</span><span class="o">=</span><span class="n">object_labels</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">entity</span><span class="o">.</span><span class="n">title</span><span class="p">()[:</span><span class="mi">2</span><span class="p">]</span> <span class="o">+</span> <span class="s2">&quot;L-&quot;</span>
<span class="p">)</span>
<span class="n">RequestConfig</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">paginate</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;per_page&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">})</span><span class="o">.</span><span class="n">configure</span><span class="p">(</span><span class="n">tb_label</span><span class="p">)</span>
<span class="n">template</span> <span class="o">=</span> <span class="n">get_template</span><span class="p">(</span><span class="s2">&quot;apis_entities/edit_generic.html&quot;</span><span class="p">)</span>
<span class="n">context</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;entity_type&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">entity</span><span class="p">,</span>
Expand Down
1 change: 0 additions & 1 deletion _modules/apis_core/apis_entities/forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ <h1>Source code for apis_core.apis_entities.forms</h1><div class="highlight"><pr
<span class="s2">&quot;apis_metainfo&quot;</span><span class="p">,</span>
<span class="s2">&quot;apis_relations&quot;</span><span class="p">,</span>
<span class="s2">&quot;apis_vocabularies&quot;</span><span class="p">,</span>
<span class="s2">&quot;apis_labels&quot;</span><span class="p">,</span>
<span class="p">],</span>
<span class="n">model</span><span class="o">=</span><span class="n">model_uri</span><span class="p">,</span>
<span class="p">)</span>
Expand Down
6 changes: 0 additions & 6 deletions _modules/apis_core/apis_entities/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ <h1>Source code for apis_core.apis_entities.models</h1><div class="highlight"><p

<span class="c1"># TODO: check if these imports can be put to top of module without</span>
<span class="c1"># causing circular import issues.</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_labels.models</span> <span class="kn">import</span> <span class="n">Label</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_vocabularies.models</span> <span class="kn">import</span> <span class="n">LabelType</span>
<span class="kn">from</span> <span class="nn">apis_core.apis_metainfo.models</span> <span class="kn">import</span> <span class="n">Uri</span>

Expand Down Expand Up @@ -362,11 +361,6 @@ <h1>Source code for apis_core.apis_entities.models</h1><div class="highlight"><p
<span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">ent</span><span class="p">,</span> <span class="n">f</span><span class="o">.</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
<span class="k">if</span> <span class="n">s</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">sl</span><span class="p">:</span>
<span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="o">.</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ent</span><span class="p">,</span> <span class="n">TempEntityClass</span><span class="p">):</span>
<span class="n">Label</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">ent</span><span class="p">),</span> <span class="n">label_type</span><span class="o">=</span><span class="n">lt</span><span class="p">,</span> <span class="n">temp_entity</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
<span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">Label</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">temp_entity</span><span class="o">=</span><span class="n">ent</span><span class="p">):</span>
<span class="n">l</span><span class="o">.</span><span class="n">temp_entity</span> <span class="o">=</span> <span class="bp">self</span>
<span class="n">l</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
<span class="n">Uri</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">root_object</span><span class="o">=</span><span class="n">ent</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">root_object</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
<span class="n">TempTriple</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">obj__id</span><span class="o">=</span><span class="n">ent</span><span class="o">.</span><span class="n">id</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">obj</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
<span class="n">TempTriple</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">subj__id</span><span class="o">=</span><span class="n">ent</span><span class="o">.</span><span class="n">id</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">subj</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
Expand Down
1 change: 0 additions & 1 deletion _modules/apis_core/apis_entities/serializers_generic.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ <h1>Source code for apis_core.apis_entities.serializers_generic</h1><div class="
<span class="kn">from</span> <span class="nn">rest_framework</span> <span class="kn">import</span> <span class="n">serializers</span>
<span class="kn">from</span> <span class="nn">reversion.models</span> <span class="kn">import</span> <span class="n">Version</span>

<span class="kn">from</span> <span class="nn">apis_core.apis_labels.serializers</span> <span class="kn">import</span> <span class="n">LabelSerializerLegacy</span> <span class="k">as</span> <span class="n">LabelSerializer</span>

<span class="n">base_uri</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="s2">&quot;APIS_BASE_URI&quot;</span><span class="p">,</span> <span class="s2">&quot;http://apis.info&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">base_uri</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">):</span>
Expand Down
Loading

0 comments on commit d106664

Please sign in to comment.