Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to adjust grid in Django's fieldset.html
    text
    copied!<p>This is a follow-up to a question I asked about modifying Django's admin forms:</p> <p>I've just created a model in Django and want to use the admin form to enter information for it. The problem I'm having is that my field names are so long that they overlap the edit boxes where their values are to be entered.</p> <p>If one follows the tutorial in the Django website, it's as if the label "Question:" overlapped the edit box where one was supposed to enter a question.</p> <p>The relevant code seems to be in /admin/includes/fieldset.html. I've edited down to:</p> <pre><code>&lt;fieldset class="module aligned {{ fieldset.classes }}"&gt; {% if fieldset.name %}&lt;h2&gt;{{ fieldset.name }} - Foo Test&lt;/h2&gt;{% endif %} {% for line in fieldset %} &lt;div class="form-row{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}"&gt; {% for field in line %} &lt;div&gt; {{ field.label_tag }}{{ field.field }} &lt;/div&gt; {% endfor %} &lt;/div&gt; {% endfor %} &lt;/fieldset&gt; </code></pre> <p>What I can't figure out how to do is to force it to give more room to {{field.label_tag}} and to move {{field.field}} over to the right.</p> <p>If it is at all helpful, here is the relevant (I believe) html that was generated:</p> <pre><code>&lt;div class="form-row field-numInvestments"&gt; &lt;div&gt; &lt;label for="id_numInvestments" class="required"&gt;NumInvestments:&lt;/label&gt;&lt;input id="id_numInvestments" type="text" class="vIntegerField" value="8000" name="numInvestments" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Any comments would be greatly appreciated,</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload