<p>The <codeclass="docutils literal notranslate"><spanclass="pre">value</span></code> field of an Attribute is pickled into a special form. This is usually not
something you need to worry about (the admin will pickle/unpickle) the value
for you), <em>except</em> if you want to store a database-object in an attribute. Such
objects are actually stored as a <codeclass="docutils literal notranslate"><spanclass="pre">tuple</span></code> with object-unique data.</p>
<p>Mark and copy this tuple-string to your clipboard exactly as it stands (parentheses and all).</p>
</li>
<li><p>Go to the entity that should have the new Attribute and create the Attribute. In its <codeclass="docutils literal notranslate"><spanclass="pre">value</span></code>
field, paste the tuple-string you copied before. Save!</p></li>
<li><p>If you want to store multiple objects in, say, a list, you can do so by literally
typing a python list <codeclass="docutils literal notranslate"><spanclass="pre">[tuple,</span><spanclass="pre">tuple,</span><spanclass="pre">tuple,</span><spanclass="pre">...]</span></code> where you paste in the serialized
tuple-strings with commas. At some point it’s probably easier to do this in code though …</p></li>
<li><p>First create the complete Account in the admin.</p></li>
<li><p>Next, create the Object (usually of <codeclass="docutils literal notranslate"><spanclass="pre">Character</span></code> typeclass) and name it the same
as the Account. It also needs a command-set. The default CharacterCmdset is a good bet.</p></li>
<li><p>In the <codeclass="docutils literal notranslate"><spanclass="pre">Puppeting</span><spanclass="pre">Account</span></code> field, select the Account.</p></li>
<li><p>Make sure to save everything.</p></li>
<li><p>Click the <codeclass="docutils literal notranslate"><spanclass="pre">Link</span><spanclass="pre">to</span><spanclass="pre">Account</span></code> button (this will only work if you saved first). This will
add the needed locks and Attributes to the Account to allow them to immediately
connect to the Character when they next log in. This will (where possible):</p>
<ulclass="simple">
<li><p>Set <codeclass="docutils literal notranslate"><spanclass="pre">account.db._last_puppet</span></code> to the Character.</p></li>
<li><p>Add Character to <codeclass="docutils literal notranslate"><spanclass="pre">account.db._playabel_characters</span></code> list.</p></li>
<li><p>Add/extend the <codeclass="docutils literal notranslate"><spanclass="pre">puppet:</span></code> lock on the Character to include <codeclass="docutils literal notranslate"><spanclass="pre">puppet:pid(<Character.id>)</span></code></p></li>
<li><p>Create an <codeclass="docutils literal notranslate"><spanclass="pre">Object</span></code> of a Room-typeclass with a suitable room-name.</p></li>
<li><p>Set an Attribute ‘desc’ on the room - the value of this Attribute is the
room’s description.</p></li>
<li><p>Add <codeclass="docutils literal notranslate"><spanclass="pre">Tags</span></code> of <codeclass="docutils literal notranslate"><spanclass="pre">type</span></code>‘alias’ to add room-aliases (no type for regular tags)</p></li>
<li><p>Exits are <codeclass="docutils literal notranslate"><spanclass="pre">Objects</span></code> of an <codeclass="docutils literal notranslate"><spanclass="pre">Exit</span></code> typeclass, so create one.</p></li>
<li><p>The exit has <codeclass="docutils literal notranslate"><spanclass="pre">Location</span></code> of the room you just created.</p></li>
<li><p>Set <codeclass="docutils literal notranslate"><spanclass="pre">Destination</span></code> set to where the exit leads to.</p></li>
<li><p>Set a ‘desc’ Attribute, this is shown if someone looks at the exit.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">Tags</span></code> of <codeclass="docutils literal notranslate"><spanclass="pre">type</span></code>‘alias’ are alternative names users can use to go through
<p>The access to the admin is controlled by the <codeclass="docutils literal notranslate"><spanclass="pre">Staff</span><spanclass="pre">status</span></code> flag on the
Account. Without this flag set, even superusers will not even see the admin
link on the web page. The staff-status has no in-game equivalence.</p>
<p>Only Superusers can change the <codeclass="docutils literal notranslate"><spanclass="pre">Superuser</span><spanclass="pre">status</span></code> flag, and grant new
permissions to accounts. The superuser is the only permission level that is
also relevant in-game. <codeclass="docutils literal notranslate"><spanclass="pre">User</span><spanclass="pre">Permissions</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Groups</span></code> found on the <codeclass="docutils literal notranslate"><spanclass="pre">Account</span></code>
admin page <em>only</em> affects the admin - they have no connection to the in-game
<p>For a staffer with <codeclass="docutils literal notranslate"><spanclass="pre">Staff</span><spanclass="pre">status</span></code> to be able to actually do anything, the
superuser must grant at least some permissions for them on their Account. This
can also be good in order to limit mistakes. It can be a good idea to not allow
the <codeclass="docutils literal notranslate"><spanclass="pre">Can</span><spanclass="pre">delete</span><spanclass="pre">Account</span></code> permission, for example.</p>
<divclass="admonition important">
<pclass="admonition-title">Important</p>
<p>If you grant staff-status and permissions to an Account and they still cannot
access the admin’s content, try reloading the server.</p>
</div>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>If a staff member has access to the in-game ``py`` command, they can just as
well have their admin ``Superuser status`` set too. The reason is that ``py``
grants them all the power they need to set the ``is_superuser`` flag on their
account manually. There is a reason access to the ``py`` command must be
<p>See the <aclass="reference internal"href="Website.html"><spanclass="std std-doc">Website</span></a> page for an overview of the components going into
generating a web page. The Django admin uses the same principle except that
Django provides a lot of tools to automate the admin-generation for us.</p>
<p>Admin templates are found in <codeclass="docutils literal notranslate"><spanclass="pre">evennia/web/templates/admin/</span></code> but you’ll find
this is relatively empty. This is because most of the templates are just
inherited directly from their original location in the Django package
(<codeclass="docutils literal notranslate"><spanclass="pre">django/contrib/admin/templates/</span></code>). So if you wanted to override one you’d have
to copy it from <em>there</em> into your <codeclass="docutils literal notranslate"><spanclass="pre">mygame/templates/admin/</span></code> folder. Same is true
for CSS files.</p>
<p>The admin site’s backend code (the views) is found in <codeclass="docutils literal notranslate"><spanclass="pre">evennia/web/admin/</span></code>. It
is organized into <codeclass="docutils literal notranslate"><spanclass="pre">admin</span></code>-classes, like <codeclass="docutils literal notranslate"><spanclass="pre">ObjectAdmin</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">AccountAdmin</span></code> etc.
These automatically use the underlying database models to generate useful views
for us without us havint go code the forms etc ourselves.</p>
<p>The top level <codeclass="docutils literal notranslate"><spanclass="pre">AdminSite</span></code> (the admin configuration referenced in django docs)
is found in <codeclass="docutils literal notranslate"><spanclass="pre">evennia/web/utils/adminsite.py</span></code>.</p>
<p>By default the admin’s title is <codeclass="docutils literal notranslate"><spanclass="pre">Evennia</span><spanclass="pre">web</span><spanclass="pre">admin</span></code>. To change this, add the
following to your <codeclass="docutils literal notranslate"><spanclass="pre">mygame/web/urls.py</span></code>:</p>
<divclass="highlight-python notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># in mygame/web/urls.py</span>
<spanclass="n">site</span><spanclass="o">.</span><spanclass="n">site_header</span><spanclass="o">=</span><spanclass="s2">"My great game admin"</span>
</pre></div>
</div>
<p>Reload the server and the admin’s title header will have changed.</p>