<spanid="evennia-web-admin-attributes"></span><h1>evennia.web.admin.attributes<aclass="headerlink"href="#module-evennia.web.admin.attributes"title="Permalink to this headline">¶</a></h1>
<p>Attribute admin.</p>
<p>Note that we don’t present a separate admin for these, since they are only
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.web.admin.attributes.</code><codeclass="sig-name descname">AttributeForm</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeForm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-name descname">Meta</code><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeForm.Meta"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm.Meta"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeForm.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>If we have an Attribute, then we’ll prepopulate our instance with the fields we’d expect it
to have based on the Attribute. attr_key, attr_category, attr_value, attr_type,
and attr_lockstring all refer to the corresponding Attribute fields. The initial data of the form fields will
<codeclass="sig-name descname">save</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">commit</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeForm.save"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm.save"title="Permalink to this definition">¶</a></dt>
<dd><p>One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we’ll try to make sure that empty form fields will be None, rather than ‘’.</p>
<codeclass="sig-name descname">clean_attr_value</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeForm.clean_attr_value"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm.clean_attr_value"title="Permalink to this definition">¶</a></dt>
<dd><p>Prevent certain data-types from being cleaned due to literal_eval
failing on them. Otherwise they will be turned into str.</p>
<emclass="property">property </em><codeclass="sig-name descname">media</code><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeForm.media"title="Permalink to this definition">¶</a></dt>
<dd><p>Return all media required to render the widgets on this form.</p>
<codeclass="sig-name descname">save</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">commit</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeFormSet.save"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeFormSet.save"title="Permalink to this definition">¶</a></dt>
<dd><p>Save model instances for every form, adding and changing instances
as necessary, and return the list of instances.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.web.admin.attributes.</code><codeclass="sig-name descname">AttributeInline</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">parent_model</span></em>, <emclass="sig-param"><spanclass="n">admin_site</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeInline"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">model</code><emclass="property"> = None</em><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.model"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">verbose_name</code><emclass="property"> = 'Attribute'</em><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.verbose_name"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">verbose_name_plural</code><emclass="property"> = 'Attributes'</em><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.verbose_name_plural"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">form</code><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.form"title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <aclass="reference internal"href="#evennia.web.admin.attributes.AttributeForm"title="evennia.web.admin.attributes.AttributeForm"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">AttributeForm</span></code></a></p>
<codeclass="sig-name descname">formset</code><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.formset"title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <aclass="reference internal"href="#evennia.web.admin.attributes.AttributeFormSet"title="evennia.web.admin.attributes.AttributeFormSet"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">AttributeFormSet</span></code></a></p>
<codeclass="sig-name descname">related_field</code><emclass="property"> = None</em><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.related_field"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">extra</code><emclass="property"> = 0</em><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.extra"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_formset</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">request</span></em>, <emclass="sig-param"><spanclass="n">obj</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/web/admin/attributes.html#AttributeInline.get_formset"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.get_formset"title="Permalink to this definition">¶</a></dt>
<dd><p>get_formset has to return a class, but we need to make the class that we return
know about the related_field that we’ll use. Returning the class itself rather than
a proxy isn’t threadsafe, since it’d be the base class and would change if multiple
<emclass="property">property </em><codeclass="sig-name descname">media</code><aclass="headerlink"href="#evennia.web.admin.attributes.AttributeInline.media"title="Permalink to this definition">¶</a></dt>