Ticket #14355: patch.4.diff
File patch.4.diff, 2.8 KB (added by , 14 years ago) |
---|
-
contrib/admin/util.py
312 312 else: 313 313 return label 314 314 315 def help_text_for_field(name, model): 316 return model._meta.get_field_by_name(name)[0].help_text 315 317 316 318 def display_for_field(value, field): 317 319 from django.contrib.admin.templatetags.admin_list import _boolean_icon -
contrib/admin/helpers.py
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 import FieldDoesNotExist … … 138 138 class_name = field.__name__ != '<lambda>' and field.__name__ or '' 139 139 else: 140 140 class_name = field 141 141 142 self.field = { 142 143 'name': class_name, 143 144 'label': label, 144 145 'field': field, 146 'help_text': help_text_for_field(class_name, form._meta.model) 145 147 } 148 146 149 self.form = form 147 150 self.model_admin = model_admin 148 151 self.is_first = is_first 149 152 self.is_checkbox = False 150 153 self.is_readonly = True 154 self.help_text = help_text_for_field(class_name, form._meta.model) 151 155 152 156 def label_tag(self): 153 157 attrs = {} -
contrib/admin/templates/admin/includes/fieldset.html
13 13 {% else %} 14 14 {{ field.label_tag }} 15 15 {% if field.is_readonly %} 16 16 <p>{{ field.contents }}</p> 17 17 {% else %} 18 18 {{ field.field }} 19 19 {% endif %} 20 {% endif %} 21 {% if field.field.help_text %} 22 <p class="help">{{ field.field.help_text|safe }}</p> 20 23 {% endif %} 21 {% if field.field.field.help_text %}22 <p class="help">{{ field.field.field.help_text|safe }}</p>23 {% endif %}24 24 </div> 25 25 {% endfor %} 26 26 </div>