Ticket #8190: 8190.tabular-inline-help-text.diff

File 8190.tabular-inline-help-text.diff, 5.4 KB (added by Julien Phalip, 13 years ago)
  • django/contrib/admin/static/admin/css/base.css

    diff --git a/django/contrib/admin/static/admin/css/base.css b/django/contrib/admin/static/admin/css/base.css
    index 23fddaf..210e969 100644
    a b tr.alt {  
    303303    background: white;
    304304}
    305305
     306th img.help-text-tooltip {
     307    cursor: help;
     308}
     309
    306310/* SORTABLE TABLES */
    307311
    308312thead th a:link, thead th a:visited {
  • new file django/contrib/admin/static/admin/img/icon_help.gif

    diff --git a/django/contrib/admin/static/admin/img/icon_help.gif b/django/contrib/admin/static/admin/img/icon_help.gif
    new file mode 100644
    index 0000000000000000000000000000000000000000..d7f013c99329f4e8af52025ab182baf0e0259fc6
    GIT binary patch
    literal 13286
    zcmeI3d3e)g9LF=*K*vOmiQ<_C#A9od^jO!}cAK4LsKv>K94anL(=N76Vv^Zz9#la^
    znF1cbR2W|96wi4f=uqZV1O@S`7Yc&cbcpA?>YKH+b3PCH{=t85+UIGSe15<8eLwH_
    z-*@s9Z>fVVzzVP~3`-`HyL<K}cJ(B7_H0S)*|2p-M|WcN`t7Y9o8zlG=eBjKOV<Wk
    zI%dsVQ!claNo|%uD=5MK_hm?qnCYv=D_M;Nzs|Cl%yJ=K!|VB=Ai9X&b)5t*_+7*d
    zn~(Cz9=<`SYF7A~=Bc$@bBJ^Ji86P-GseUsa)j4dJQfLyDid=NtY50<8E~&ZCJDSB
    z(LyewLVtnlV|pZo$89Fc$WbK}UP7B_i`8zo7vpA%rbx<6(q<!VXDnuhqVV)ZxbwlC
    zQ}G9wX_emeaNwVdXwWp7A<1YoYKmG+k`g3ohr^+_F`JEmFse<W#>R}IIw93$f1gTT
    z<rG2I1WCm8zHGhJsJRG2A1HIB*A<a71Bt4se~l(iijXl@CTSBzW;%mHCvd`e6rR;2
    zrB;%{?$pY?g2G27C8Xk>8XHc7D)6zET5%uC38E&c4Nh`!Wp*mrraag(-VIdIMyk|E
    zm(<cUW3_?r>;d&DXi&LN@(Y2cf0bJp+QLxgbol@%UG5}xI|FR>Z-u_lLC^ooqMyr1
    zlpB?B|6chyk`MC{Uer_|lK!ViKgR?lCBkZMA;JcEGAIO`WcJ|!=a-r_$O?!lnaSz?
    zsb}{0pxk7=AC&f~rf3i-xkwk%1!VvVM(IMjpbS94C|yVwlmRFhr3>kTG5`gmbRk_(
    z2B2V+E~E>}02GYUg>*p~fPzuFkS-_#P%ugt(gkGz3P$Ndx}Xd|!6;ow7nA`g7^Ms8
    zf-(RFqjVu%PzIo2lrE$T$^aCM(uH(E8GwROx{xj?15hwZ7t#e~018IwLb{*~K*1<o
    zNEeg=DENTs%Fmws;6-rUBMQ!S<Rt(4^N-(u>-+VWpMU!Chkf7g?fvfCo^QVX>dP<o
    z?EZY$&d)yG@yW*@efUA*{rBE|=k4upZQJ_h8(TKNzUj4BU+I3iYvW5VZs>gB`St6b
    zTl?%YPe1i!#}kh~_UI!IuX*Uf_6P1?ec!$J+<n)owv{XHyyN!P<;#}dcIz!SFIl|k
    zrW;!p-f;bb>#n_K{=BQNiqF0Bipwu+Zi+=OZPZld5?K->;n2lGLomSmxq7zlqB$2{
    zaQ^IBGiRJPy|!lBxz*=P^__jznNzAJd(Wu!oL*60=5{$T#!+f7u~{u<aHhm$EG|0r
    zl#@@IbmGJbgaJR{_~VW}=IHT99XalZ!m(pUk2-whVFe@d4?Se~u)N%%Lvk?8(3hJt
    z92<=l>&I#I136fpx2`a6)6j}VV-{?yTe;WL(rduF`xaB!_;^=)Zm4_|Hh<(W2Nf@v
    l)KZNXFDI)u8hk6p#fxhAAqyLemKEB@E}7FlePS+l+TT)>fy4j+
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

    literal 0
    HcmV?d00001
    
    diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html
    index 29db95a..b2970c6 100644
    a b  
    99     <thead><tr>
    1010     {% for field in inline_admin_formset.fields %}
    1111       {% if not field.widget.is_hidden %}
    12          <th{% if forloop.first %} colspan="2"{% endif %}{% if field.required %} class="required"{% endif %}>{{ field.label|capfirst }}</th>
     12         <th{% if forloop.first %} colspan="2"{% endif %}{% if field.required %} class="required"{% endif %}>
     13            {{ field.label|capfirst }}
     14            {% if field.help_text %}&nbsp;<img class="help-text-tooltip" src="{% static "admin/img/icon_help.gif" %}" alt="({{ field.help_text|striptags }})" title="{{ field.help_text|striptags }}" />{% endif %}
     15         </th>
    1316       {% endif %}
    1417     {% endfor %}
    1518     {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %}
  • tests/regressiontests/admin_inlines/models.py

    diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py
    index ee0abd1..8d9ca7c 100644
    a b admin.site.register(Holder2, HolderAdmin, inlines=[InnerInline2])  
    103103# only Inline media
    104104admin.site.register(Holder3, inlines=[InnerInline3])
    105105
     106
     107# Models for ticket #8190
     108
     109class Holder4(models.Model):
     110    dummy = models.IntegerField()
     111
     112class Inner4Stacked(models.Model):
     113    dummy = models.IntegerField(help_text="Awesome stacked help text is awesome.")
     114    holder = models.ForeignKey(Holder4)
     115
     116class Inner4Tabular(models.Model):
     117    dummy = models.IntegerField(help_text="Awesome tabular help text is awesome.")
     118    holder = models.ForeignKey(Holder4)
     119
     120class Inner4StackedInline(admin.StackedInline):
     121    model = Inner4Stacked
     122
     123class Inner4TabularInline(admin.TabularInline):
     124    model = Inner4Tabular
     125
     126class Holder4Admin(admin.ModelAdmin):
     127    inlines = [Inner4StackedInline, Inner4TabularInline]
     128
     129admin.site.register(Holder4, Holder4Admin)
     130
     131
    106132# Models for #12749
    107133
    108134class Person(models.Model):
  • tests/regressiontests/admin_inlines/tests.py

    diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py
    index 067b3c5..a3223f1 100644
    a b class TestInline(TestCase):  
    103103        # column cells
    104104        self.assertContains(response, '<p>Callable in QuestionInline</p>')
    105105
     106    def test_help_text(self):
     107        """
     108        Ensure that the inlines' model field help texts are displayed when
     109        using both the stacked and tabular layouts.
     110        Ref #8190.
     111        """
     112        response = self.client.get('/test_admin/admin/admin_inlines/holder4/add/')
     113        self.assertContains(response, '<p class="help">Awesome stacked help text is awesome.</p>', 4)
     114        self.assertContains(response, '<img class="help-text-tooltip" src="/static/admin/img/icon_help.gif" alt="(Awesome tabular help text is awesome.)" title="Awesome tabular help text is awesome." />', 1)
     115
    106116class TestInlineMedia(TestCase):
    107117    fixtures = ['admin-views-users.xml']
    108118
Back to Top