简体   繁体   English

在Django Admin网站的TubularInline中添加注释

[英]Adding note in Django Admin site's TubularInline

Currently my django admin site's setup looks like 目前我的django管理网站的设置看起来像

Topic

  submit_date: 2018/09/25
  submit_user: blah

Topic-category1

  sub-topic    field1    field2
---------------------------------
  bleh         bleh1     bleh2
  mlem         mlem1     mlem2

Topic-category2

  something    something1    something2
---------------------------------------
  asd          asd1          asd2
  asd2         asd2-1        asd2-2

I want to add a note section in between Topic-category1 and the table, so it looks like 我想在Topic-category1和表格之间添加一个注释部分,因此它看起来像

Topic-category1

<this is where the note goes, functions like description>

  sub-topic    field1    field2
---------------------------------
  bleh         bleh1     bleh2
  mlem         mlem1     mlem2

Is there a way for django admin to do it? django管理员有办法吗? I'm not using any of the custom form. 我没有使用任何自定义表单。 Only using ModelAdmin and modify variables here and there 仅使用ModelAdmin并在此处和此处修改变量

Okay turns out I can't do it without having a custom form for Django Admin. 好的,事实是,如果没有针对Django Admin的自定义表单,我将无法做到。

https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fieldsets https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fieldsets

I can add description using fieldsets , but it doesn't apply to TabularInline as it cannot be rendered. 我可以使用fieldsets添加描述,但由于它无法呈现,因此不适用于TabularInline。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM