Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #13782 -- Added CSS for errors in textareas and multiple fields…

… in one line. Thanks, julien.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14999 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 75f16982d839be682b4f54d9f179caa4a86c07a5 1 parent b224b05
Jannis Leidel authored December 21, 2010
3  django/contrib/admin/helpers.py
@@ -127,6 +127,9 @@ def label_tag(self):
127 127
         attrs = classes and {'class': u' '.join(classes)} or {}
128 128
         return self.field.label_tag(contents=contents, attrs=attrs)
129 129
 
  130
+    def errors(self):
  131
+        return mark_safe(self.field.errors.as_ul())
  132
+
130 133
 class AdminReadonlyField(object):
131 134
     def __init__(self, form, field, is_first, model_admin=None):
132 135
         label = label_for_field(field, form._meta.model, model_admin)
2  django/contrib/admin/media/css/base.css
@@ -509,7 +509,7 @@ td ul.errorlist li {
509 509
     background: #ffc;
510 510
 }
511 511
 
512  
-.errors input, .errors select {
  512
+.errors input, .errors select, .errors textarea {
513 513
     border: 1px solid red;
514 514
 }
515 515
 
7  django/contrib/admin/templates/admin/includes/fieldset.html
@@ -4,10 +4,11 @@
4 4
         <div class="description">{{ fieldset.description|safe }}</div>
5 5
     {% endif %}
6 6
     {% for line in fieldset %}
7  
-        <div class="form-row{% if line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}">
8  
-            {{ line.errors }}
  7
+        <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}">
  8
+            {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
9 9
             {% for field in line %}
10  
-                <div{% if not line.fields|length_is:"1" %} class="field-box"{% endif %}>
  10
+                <div{% if not line.fields|length_is:'1' %} class="field-box{% if not field.is_readonly and field.errors %} errors{% endif %}"{% endif %}>
  11
+                    {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
11 12
                     {% if field.is_checkbox %}
12 13
                         {{ field.field }}{{ field.label_tag }}
13 14
                     {% else %}

0 notes on commit 75f1698

Please sign in to comment.
Something went wrong with that request. Please try again.