Help text in Django Inline Admin

I am using the built-in admin in my Django application. I want the help text to appear in the admin form for the page to go with the built-in administrator (and not just a separate help text for each field in this model). I tried to figure out how to do this, but it seems I can not find anything in this matter. Did I miss some simple option for this?

If there is no super easy way to do this, is there a way to do this by expanding some template?

The following are parts of my models and their administrators:

class Page(models.Model): .... class File(models.Model): page = models.ForeignKey(Page) .... class FileAdminInline(admin.TabularInline): model = File extra = 0 class PageAdmin(admin.ModelAdmin): inlines = (FileAdminInline,) 
+6
source share
2 answers

If you are not talking about a specific help_text attribute, then look at this post , it shows an undocumented way to accomplish this.

+2
source

If you do not want to interfere in obtaining help_text information in the context of a set of forms and modify the edit_inline template, there is a way to capture the verbose_name_plural Meta attribute of your model for this purpose.

The basic idea: if you mark this line as safe, you can insert any html element that comes to your mind. For example, an image element with its title sets the global help text for your model. It might look something like this:

 class Meta: verbose_name = "Ygritte" verbose_name_plural = mark_safe('Ygrittes <img src="' + settings.STATIC_URL + \ 'admin/img/icon-unknown.svg" class="help help-tooltip" ' 'width="15" height="15" ' 'title="You know nothing, Jon Snow"/>') 

Of course, this is a kind of hacking, but it works quite simply if your model is available only as a built-in model, and you do not need a verbose verbose name for other things (for example, in the list of models in the overview of your application).

0
source

All Articles