【问题标题】:How to alter label tag of fieldset in django admin page using admin.tabularinline如何使用 admin.tabularinline 在 django 管理页面中更改字段集的标签标记
【发布时间】:2019-12-28 09:30:54
【问题描述】:

我使用 admin.tabularinline 在我的 django 管理员中自定义了我的添加用户表单。因此,每当管理员添加用户时,有关Usermodel 和UserProfile 模型的信息都会同时保存。但是,UserProfile 表单的标签标记为“Staff Profiles”(带有“s”)。而且它看起来不太好,因为一个用户只有一个配置文件。任何想法如何将“员工档案”更改为“员工档案”? 参考图片:

【问题讨论】:

标签: python django admin


【解决方案1】:

按照docs 中的说明,将verbose_name_plural 更改为UserProfileInline

在管理员声明中,添加

class UserProfileInline(admin.YourInlineChoice):
    verbose_name_plural="Staff Profile"
    [Your params]

【讨论】:

    最近更新 更多