Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #13782 -- Added CSS for errors in textareas and multipl…

…e fields in one line. Thanks, julien.

Backport from trunk (r14999).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15003 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit eb18ea78998f28687b01adcd83970a472dad5e75 1 parent af1c8b2
@jezdez jezdez authored
View
3  django/contrib/admin/helpers.py
@@ -128,6 +128,9 @@ def label_tag(self):
attrs = classes and {'class': u' '.join(classes)} or {}
return self.field.label_tag(contents=contents, attrs=attrs)
+ def errors(self):
+ return mark_safe(self.field.errors.as_ul())
+
class AdminReadonlyField(object):
def __init__(self, form, field, is_first, model_admin=None):
label = label_for_field(field, form._meta.model, model_admin)
View
2  django/contrib/admin/media/css/base.css
@@ -496,7 +496,7 @@ td ul.errorlist li {
background: #ffc;
}
-.errors input, .errors select {
+.errors input, .errors select, .errors textarea {
border: 1px solid red;
}
View
7 django/contrib/admin/templates/admin/includes/fieldset.html
@@ -4,10 +4,11 @@
<div class="description">{{ fieldset.description|safe }}</div>
{% endif %}
{% for line in fieldset %}
- <div class="form-row{% if line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}">
- {{ line.errors }}
+ <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}">
+ {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
{% for field in line %}
- <div{% if not line.fields|length_is:"1" %} class="field-box"{% endif %}>
+ <div{% if not line.fields|length_is:'1' %} class="field-box{% if not field.is_readonly and field.errors %} errors{% endif %}"{% endif %}>
+ {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
{% if field.is_checkbox %}
{{ field.field }}{{ field.label_tag }}
{% else %}
Please sign in to comment.
Something went wrong with that request. Please try again.