Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#8190 closed New feature (fixed)

Utilise help_text for TabularInline in Admin

Reported by: glenjamin Owned by: Alexander Herrmann
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: rlaager@…, net147@…, glicerinu@…, django@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: yes

Description

When using TabularInline in the automatic admin interface the help_text for fields is not displayed anywhere.

I suggest that the information could be displayed as a tooltip on the column heading, like so:

<th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst|escape }}</th>

becomes

<th {% if forloop.first %}colspan="2"{% endif %}>
  {{ field.label|capfirst|escape }}
  {% if field.help_text %}<abbr class="help-text-tooltip" title="{{ field.help_text|striptags }}">?</abbr>{% endif %}
</th>

and then in the CSS:

.help-text-tooltip { cursor: help; }

Attachments (2)

8190-r16351.diff (1.4 KB) - added by Alexander Herrmann 5 years ago.
8190.tabular-inline-help-text.diff (5.4 KB) - added by Julien Phalip 5 years ago.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 8 years ago by Jacob

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by anonymous

I would prefer this:

         <th {% if forloop.first %}colspan="2"{% endif %}>
           <span class="inline-field-label">{{ field.label|capfirst }}</span>
           {% if field.help_text %}<abbr class="help" title="{{ field.help_text|striptags }}">?</abbr>{% endif %}
         </th>

and

.inline-group .tabular .inline-field-label {
    float: left;
}

.inline-group .tabular abbr.help {
    cursor: help;
    float: right;
}

comment:3 Changed 7 years ago by anonymous

Cc: rlaager@… added

comment:4 Changed 6 years ago by net147

Cc: net147@… added

comment:5 Changed 6 years ago by Ramiro Morales

#6077 proposed the same with a slightly different UI.

comment:6 Changed 6 years ago by Marc Aymerich

Cc: glicerinu@… added

comment:7 Changed 6 years ago by Julien Phalip

milestone: 1.4

I'd like to see this in 1.4.

comment:8 Changed 5 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:9 Changed 5 years ago by Julien Phalip

UI/UX: set

comment:10 Changed 5 years ago by Alexander Herrmann

Easy pickings: unset
Owner: changed from nobody to Alexander Herrmann
Status: newassigned

Changed 5 years ago by Alexander Herrmann

Attachment: 8190-r16351.diff added

comment:11 Changed 5 years ago by Alexander Herrmann

Has patch: set

comment:12 Changed 5 years ago by Julien Phalip

Needs tests: set

comment:13 Changed 5 years ago by jedie

Cc: django@… added

Whats about simply add the help_text to td title ?

e.g:

django/contrib/admin/templates/admin/edit_inline/tabular.html
@@ -42,7 +42,7 @@
{% for fieldset in inline_admin_form %}
{% for line in fieldset %}
{% for field in line %}
- <td class="{{ field.field.name }}">
+ <td class="{{ field.field.name }}" title="{{ field.field.help_text }}">
{% if field.is_readonly %}
<p>{{ field.contents }}</p>
{% else %}

Changed 5 years ago by Julien Phalip

comment:14 Changed 5 years ago by Julien Phalip

Needs tests: unset

The attached patch contains a binary image I've created to symbolise the help text (instead of using a '?' character). I've also added some tests.

comment:15 Changed 5 years ago by Julien Phalip

By the way, you will need to use 'git apply' to create the binary image from the patch.

comment:16 Changed 5 years ago by Jannis Leidel

Patch needs improvement: set

I don't know the small icon looks a little odd (to dark), maybe we could ask our Design BDFL to create a better one.

Version 0, edited 5 years ago by Jannis Leidel (next)

comment:17 Changed 5 years ago by Jannis Leidel

comment:18 Changed 5 years ago by Idan Gazit

Small icon is indeed too dark. icon-unknown.gif would be a fine solution here, even if it is used for other purposes elsewhere.

comment:19 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [16622]:

Fixed #8190 -- Added support for a field's help text to the tabular admin inline. Thanks, Julien Phalip and Idan Gazit.

comment:20 Changed 5 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top