Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 26, 2024
1 parent 8f7d068 commit 49fd3d9
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions _modules/apis_core/apis_entities/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ <h1>Source code for apis_core.apis_entities.models</h1><div class="highlight"><p

<span class="kn">from</span> <span class="nn">django.contrib.contenttypes.models</span> <span class="kn">import</span> <span class="n">ContentType</span>
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.models</span> <span class="kn">import</span> <span class="n">Group</span>
<span class="kn">from</span> <span class="nn">django.db.models.signals</span> <span class="kn">import</span> <span class="n">post_save</span>
<span class="kn">from</span> <span class="nn">django.dispatch</span> <span class="kn">import</span> <span class="n">receiver</span>
<span class="kn">from</span> <span class="nn">django.urls</span> <span class="kn">import</span> <span class="n">reverse</span>
Expand Down Expand Up @@ -402,21 +401,6 @@ <h1>Source code for apis_core.apis_entities.models</h1><div class="highlight"><p
<span class="n">uri2</span> <span class="o">=</span> <span class="n">Uri</span><span class="p">(</span><span class="n">uri</span><span class="o">=</span><span class="n">uri_c</span><span class="p">,</span> <span class="n">domain</span><span class="o">=</span><span class="s2">&quot;apis default&quot;</span><span class="p">,</span> <span class="n">root_object</span><span class="o">=</span><span class="n">instance</span><span class="p">)</span>
<span class="n">uri2</span><span class="o">.</span><span class="n">save</span><span class="p">()</span></div>



<span class="k">if</span> <span class="s2">&quot;registration&quot;</span> <span class="ow">in</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="s2">&quot;INSTALLED_APPS&quot;</span><span class="p">,</span> <span class="p">[]):</span>
<span class="kn">from</span> <span class="nn">registration.backends.simple.views</span> <span class="kn">import</span> <span class="n">RegistrationView</span>
<span class="kn">from</span> <span class="nn">registration.signals</span> <span class="kn">import</span> <span class="n">user_registered</span>

<span class="nd">@receiver</span><span class="p">(</span>
<span class="n">user_registered</span><span class="p">,</span>
<span class="n">sender</span><span class="o">=</span><span class="n">RegistrationView</span><span class="p">,</span>
<span class="n">dispatch_uid</span><span class="o">=</span><span class="s2">&quot;add_registered_user_to_group&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">def</span> <span class="nf">add_user_to_group</span><span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">user</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">user_group</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_AUTO_USERGROUP&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">user_group</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">user</span><span class="o">.</span><span class="n">groups</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">Group</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">user_group</span><span class="p">))</span>
</pre></div>

</div>
Expand Down

0 comments on commit 49fd3d9

Please sign in to comment.