diff --git a/AUTHORS b/AUTHORS
index 070ec70..844038c 100644
a
|
b
|
answer newbie questions, and generally made Django that much better:
|
589 | 589 | Gasper Zejn <zejn@kiberpipa.org> |
590 | 590 | Jarek Zgoda <jarek.zgoda@gmail.com> |
591 | 591 | Cheng Zhang |
| 592 | Marc Aymerich Gubern |
592 | 593 | |
593 | 594 | A big THANK YOU goes to: |
594 | 595 | |
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index 4203287..be66b0d 100644
a
|
b
|
class InlineAdminFormSet(object):
|
225 | 225 | def fields(self): |
226 | 226 | fk = getattr(self.formset, "fk", None) |
227 | 227 | for i, field in enumerate(flatten_fieldsets(self.fieldsets)): |
| 228 | if callable(field): |
| 229 | class_name = field.__name__ != '<lambda>' and field.__name__ or '' |
| 230 | else: |
| 231 | class_name = field |
228 | 232 | if fk and fk.name == field: |
229 | 233 | continue |
230 | 234 | if field in self.readonly_fields: |
… |
… |
class InlineAdminFormSet(object):
|
233 | 237 | 'widget': { |
234 | 238 | 'is_hidden': False |
235 | 239 | }, |
236 | | 'required': False |
| 240 | 'required': False, |
| 241 | 'help_text': help_text_for_field(class_name, self.opts.model), |
237 | 242 | } |
238 | 243 | else: |
239 | 244 | yield self.formset.form.base_fields[field] |
diff --git a/tests/regressiontests/admin_inlines/admin.py b/tests/regressiontests/admin_inlines/admin.py
index 536c3ec..d252457 100644
a
|
b
|
class HolderAdmin(admin.ModelAdmin):
|
28 | 28 | js = ('my_awesome_admin_scripts.js',) |
29 | 29 | |
30 | 30 | |
| 31 | class ROnlyInlineInline(admin.TabularInline): |
| 32 | model = ROnlyInline |
| 33 | readonly_fields = ['name'] |
| 34 | |
| 35 | |
31 | 36 | class InnerInline2(admin.StackedInline): |
32 | 37 | model = Inner2 |
33 | 38 | |
… |
… |
site.register(Novel, NovelAdmin)
|
142 | 147 | site.register(Fashionista, inlines=[InlineWeakness]) |
143 | 148 | site.register(Holder4, Holder4Admin) |
144 | 149 | site.register(Author, AuthorAdmin) |
145 | | site.register(CapoFamiglia, inlines=[ConsigliereInline, SottoCapoInline]) |
| 150 | site.register(CapoFamiglia, inlines=[ConsigliereInline, SottoCapoInline, ROnlyInlineInline]) |
146 | 151 | site.register(ProfileCollection, inlines=[ProfileInline]) |
147 | 152 | site.register(ParentModelWithCustomPk, inlines=[ChildModel1Inline, ChildModel2Inline]) |
148 | 153 | site.register(ExtraTerrestrial, inlines=[SightingInline]) |
diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py
index 147873a..ad7230c 100644
a
|
b
|
class Novel(models.Model):
|
130 | 130 | class Chapter(models.Model): |
131 | 131 | novel = models.ForeignKey(Novel) |
132 | 132 | |
133 | | |
134 | 133 | # Models for #16838 |
135 | 134 | |
136 | 135 | class CapoFamiglia(models.Model): |
… |
… |
class CapoFamiglia(models.Model):
|
138 | 137 | |
139 | 138 | |
140 | 139 | class Consigliere(models.Model): |
141 | | name = models.CharField(max_length=100) |
| 140 | name = models.CharField(max_length=100, help_text='Help text for Consigliere') |
142 | 141 | capo_famiglia = models.ForeignKey(CapoFamiglia, related_name='+') |
143 | 142 | |
144 | 143 | |
… |
… |
class SottoCapo(models.Model):
|
146 | 145 | name = models.CharField(max_length=100) |
147 | 146 | capo_famiglia = models.ForeignKey(CapoFamiglia, related_name='+') |
148 | 147 | |
| 148 | |
| 149 | class ROnlyInline(models.Model): |
| 150 | name = models.CharField(max_length=100, help_text='Help text for ROnlyInline') |
| 151 | capo_famiglia = models.ForeignKey(CapoFamiglia) |
| 152 | |
| 153 | |
149 | 154 | # Models for #18433 |
150 | 155 | |
151 | 156 | class ParentModelWithCustomPk(models.Model): |
diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py
index 54283bf..3e3889c 100644
a
|
b
|
class TestInline(TestCase):
|
122 | 122 | response = self.client.get('/admin/admin_inlines/holder4/add/') |
123 | 123 | self.assertContains(response, '<p class="help">Awesome stacked help text is awesome.</p>', 4) |
124 | 124 | self.assertContains(response, '<img src="/static/admin/img/icon-unknown.gif" class="help help-tooltip" width="10" height="10" alt="(Awesome tabular help text is awesome.)" title="Awesome tabular help text is awesome." />', 1) |
| 125 | # ronly fields |
| 126 | response = self.client.get('/admin/admin_inlines/capofamiglia/add/') |
| 127 | self.assertContains(response, '<img src="/static/admin/img/icon-unknown.gif" class="help help-tooltip" width="10" height="10" alt="(Help text for ROnlyInline)" title="Help text for ROnlyInline" />', 1) |
| 128 | |
125 | 129 | |
126 | 130 | def test_non_related_name_inline(self): |
127 | 131 | """ |