Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有一个叫做小丑的 django 模型:
我让属性列表显示在 Django admin 中,如下所示:
如何使 Django Admin UI 中的列表与实际变量不同?就像假设变量是标识,我希望它在管理中显示为 id。
您可以定义模型字段的自定义表示方法。这必须给你你想要的
class ClownAdmin(admin.ModelAdmin): def get_id(self, obj): return obj.identification get_id.short_description = 'id' list_display('name', 'get_id', 'stupid', 'fat')