diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index b90f5ec..3c1bef3 100644
a
|
b
|
|
1 | 1 | from django import forms |
2 | 2 | from django.conf import settings |
3 | 3 | from django.contrib.admin.util import flatten_fieldsets, lookup_field |
4 | | from django.contrib.admin.util import display_for_field, label_for_field |
| 4 | from django.contrib.admin.util import display_for_field, label_for_field, help_text_for_field |
5 | 5 | from django.contrib.contenttypes.models import ContentType |
6 | 6 | from django.core.exceptions import ObjectDoesNotExist |
7 | 7 | from django.db.models.fields.related import ManyToManyRel |
… |
… |
class AdminReadonlyField(object):
|
144 | 144 | 'name': class_name, |
145 | 145 | 'label': label, |
146 | 146 | 'field': field, |
| 147 | 'help_text': help_text_for_field(class_name, form._meta.model) |
147 | 148 | } |
148 | 149 | self.form = form |
149 | 150 | self.model_admin = model_admin |
diff --git a/django/contrib/admin/templates/admin/includes/fieldset.html b/django/contrib/admin/templates/admin/includes/fieldset.html
index addfd08..6363aee 100644
a
|
b
|
|
19 | 19 | {{ field.field }} |
20 | 20 | {% endif %} |
21 | 21 | {% endif %} |
22 | | {% if field.field.field.help_text %} |
23 | | <p class="help">{{ field.field.field.help_text|safe }}</p> |
| 22 | {% if field.field.help_text %} |
| 23 | <p class="help">{{ field.field.help_text|safe }}</p> |
24 | 24 | {% endif %} |
25 | 25 | </div> |
26 | 26 | {% endfor %} |
diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py
index 1c39614..d3f17d6 100644
a
|
b
|
def label_for_field(name, model, model_admin=None, return_attr=False):
|
266 | 266 | else: |
267 | 267 | return label |
268 | 268 | |
| 269 | def help_text_for_field(name, model): |
| 270 | try: |
| 271 | help_text = model._meta.get_field_by_name(name)[0].help_text |
| 272 | except models.FieldDoesNotExist: |
| 273 | help_text = "" |
| 274 | return smart_unicode(help_text) |
| 275 | |
269 | 276 | |
270 | 277 | def display_for_field(value, field): |
271 | 278 | from django.contrib.admin.templatetags.admin_list import _boolean_icon |
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index 60319ea..c344a14 100644
a
|
b
|
class LinkInline(admin.TabularInline):
|
523 | 523 | |
524 | 524 | |
525 | 525 | class Post(models.Model): |
526 | | title = models.CharField(max_length=100) |
527 | | content = models.TextField() |
528 | | posted = models.DateField(default=datetime.date.today) |
| 526 | title = models.CharField(max_length=100, help_text="Some help text for the title (with unicode ŠĐĆŽćžšđ)") |
| 527 | content = models.TextField(help_text="Some help text for the content (with unicode ŠĐĆŽćžšđ)") |
| 528 | posted = models.DateField( |
| 529 | default=datetime.date.today, |
| 530 | help_text="Some help text for the date (with unicode ŠĐĆŽćžšđ)" |
| 531 | ) |
529 | 532 | public = models.NullBooleanField() |
530 | 533 | |
531 | 534 | def awesomeness_level(self): |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index acbbbfc..e4644e1 100644
a
|
b
|
class ReadonlyTest(TestCase):
|
2392 | 2392 | self.assertContains(response, '<div class="form-row posted">') |
2393 | 2393 | self.assertContains(response, '<div class="form-row value">') |
2394 | 2394 | self.assertContains(response, '<div class="form-row ">') |
| 2395 | self.assertContains(response, '<p class="help">', 3) |
| 2396 | self.assertContains(response, '<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>') |
| 2397 | self.assertContains(response, '<p class="help">Some help text for the content (with unicode ŠĐĆŽćžšđ)</p>') |
| 2398 | self.assertContains(response, '<p class="help">Some help text for the date (with unicode ŠĐĆŽćžšđ)</p>') |
2395 | 2399 | |
2396 | 2400 | p = Post.objects.create(title="I worked on readonly_fields", content="Its good stuff") |
2397 | 2401 | response = self.client.get('/test_admin/admin/admin_views/post/%d/' % p.pk) |