Ticket #7054: 7054.patch

File 7054.patch, 3.4 KB (added by Robert Myers, 16 years ago)
  • django/contrib/admin/options.py

     
    8787        else:
    8888            self.fields = field
    8989
     90    def __len__(self):
     91        try:
     92            return len(self.fields)
     93        except TypeError:
     94            return 1
     95   
    9096    def __iter__(self):
    9197        for i, field in enumerate(self.fields):
    9298            yield AdminField(self.form, field, is_first=(i == 0))
  • django/contrib/admin/templates/admin/includes/fieldset.html

     
    44  {% for line in fieldset %}
    55      <div class="form-row{% if line.errors %} errors{% endif %} {% for field in line %}{{ field.field.name }} {% endfor %} ">
    66      {{ line.errors }}
     7      {% with line|length as length %}
    78      {% for field in line %}
     9          {% ifnotequal length 1 %}<div class="inline-fieldset">{% endifnotequal %}
    810          {% if field.is_checkbox %}
    911              {{ field.field }}{{ field.label_tag }}
    1012          {% else %}
     
    1113              {{ field.label_tag }}{{ field.field }}
    1214          {% endif %}
    1315          {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %}
     16          {% ifnotequal length 1 %}</div>{% endifnotequal %}
    1417      {% endfor %}
     18      {% endwith %}
    1519      </div>
    1620  {% endfor %}
    1721</fieldset>
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

     
    4242              <td class="{{ field.field.name }}">
    4343              {{ field.field.errors.as_ul }}
    4444              {{ field.field }}
     45              {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %}
    4546              </td>
    4647            {% endfor %}
    4748          {% endfor %}
  • django/contrib/admin/media/css/forms.css

     
    2121/* ALIGNED FIELDSETS */
    2222.aligned label { display:block; padding:0 1em 3px 0; float:left; width:8em; }
    2323.aligned label.inline { display:inline; float:none; }
     24.inline-fieldset {float:left;}
     25.inline-fieldset p.help { max-width:20em; }
    2426.colMS .aligned .vLargeTextField, .colMS .aligned .vXMLLargeTextField { width:350px; }
    2527form .aligned p, form .aligned ul { margin-left:7em; padding-left:30px; }
    2628form .aligned table p { margin-left:0; padding-left:0; }
     
    7274.inline-related fieldset {margin: 0; background:#fff; border: none; }
    7375.inline-related fieldset.module h3 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; }
    7476.inline-related.tabular fieldset.module table {width:100%;}
     77.inline-related.tabular p.help {max-width:20em;}
    7578.last-related fieldset {border: none;}
    7679
    7780.inline-group .tabular tr.has_original td {padding-top:2em;}
Back to Top