Django中ModelAdmin的标签名称

时间:2013-03-14 20:34:15

标签: python django

如何为此类提供一个标签,该标签显示在后端而不是“EditedAddress”?

class EditedAddressAdmin(admin.ModelAdmin):
    list_display = ('comp_name','fam_name', 'fon')
    search_fields = ['fam_name','comp_name']


admin.site.register(EditedAddress,EditedAddressAdmin)

1 个答案:

答案 0 :(得分:17)

您可以通过向模型添加verbose_name和/或verbose_name_plural来调整模型名称的显示方式:

class EditedAddress(models.Model):
    class Meta:
        verbose_name = 'Edited Address'
        verbose_name_plural = 'Edited Addresses'