1 | Index: contrib/admin/util.py
|
---|
2 | ===================================================================
|
---|
3 | --- contrib/admin/util.py (revision 13975)
|
---|
4 | +++ contrib/admin/util.py (working copy)
|
---|
5 | @@ -312,7 +312,17 @@
|
---|
6 | else:
|
---|
7 | return label
|
---|
8 |
|
---|
9 | +def help_text_for_field(name, model):
|
---|
10 | + return model._meta.get_field_by_name(name)[0].help_text
|
---|
11 | +
|
---|
12 | def display_for_field(value, field):
|
---|
13 | from django.contrib.admin.templatetags.admin_list import _boolean_icon
|
---|
14 | from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
|
---|
15 | Index: contrib/admin/helpers.py
|
---|
16 | ===================================================================
|
---|
17 | --- contrib/admin/helpers.py (revision 13975)
|
---|
18 | +++ contrib/admin/helpers.py (working copy)
|
---|
19 | @@ -1,7 +1,7 @@
|
---|
20 | from django import forms
|
---|
21 | from django.conf import settings
|
---|
22 | from django.contrib.admin.util import flatten_fieldsets, lookup_field
|
---|
23 | -from django.contrib.admin.util import display_for_field, label_for_field
|
---|
24 | +from django.contrib.admin.util import display_for_field, label_for_field, help_text_for_field
|
---|
25 | from django.contrib.contenttypes.models import ContentType
|
---|
26 | from django.core.exceptions import ObjectDoesNotExist
|
---|
27 | from django.db.models.fields import FieldDoesNotExist
|
---|
28 | @@ -138,16 +138,20 @@
|
---|
29 | class_name = field.__name__ != '<lambda>' and field.__name__ or ''
|
---|
30 | else:
|
---|
31 | class_name = field
|
---|
32 | +
|
---|
33 | self.field = {
|
---|
34 | 'name': class_name,
|
---|
35 | 'label': label,
|
---|
36 | 'field': field,
|
---|
37 | + 'help_text': help_text_for_field(class_name, form._meta.model)
|
---|
38 | }
|
---|
39 | +
|
---|
40 | self.form = form
|
---|
41 | self.model_admin = model_admin
|
---|
42 | self.is_first = is_first
|
---|
43 | self.is_checkbox = False
|
---|
44 | self.is_readonly = True
|
---|
45 | + self.help_text = help_text_for_field(class_name, form._meta.model)
|
---|
46 |
|
---|
47 | def label_tag(self):
|
---|
48 | attrs = {}
|
---|
49 | Index: contrib/admin/templates/admin/includes/fieldset.html
|
---|
50 | ===================================================================
|
---|
51 | --- contrib/admin/templates/admin/includes/fieldset.html (revision 13975)
|
---|
52 | +++ contrib/admin/templates/admin/includes/fieldset.html (working copy)
|
---|
53 | @@ -13,14 +13,14 @@
|
---|
54 | {% else %}
|
---|
55 | {{ field.label_tag }}
|
---|
56 | {% if field.is_readonly %}
|
---|
57 | - <p>{{ field.contents }}</p>
|
---|
58 | + <p>{{ field.contents }}</p>
|
---|
59 | {% else %}
|
---|
60 | {{ field.field }}
|
---|
61 | {% endif %}
|
---|
62 | + {% endif %}
|
---|
63 | + {% if field.field.help_text %}
|
---|
64 | + <p class="help">{{ field.field.help_text|safe }}</p>
|
---|
65 | {% endif %}
|
---|
66 | - {% if field.field.field.help_text %}
|
---|
67 | - <p class="help">{{ field.field.field.help_text|safe }}</p>
|
---|
68 | - {% endif %}
|
---|
69 | </div>
|
---|
70 | {% endfor %}
|
---|
71 | </div>
|
---|
72 | 1,1 Top
|
---|