如何自定义django管理员的课程?

时间:2016-06-06 17:51:23

标签: django

您好我想在我的django admin中添加一个自定义类,覆盖默认更新,但我不能

class Aprovacao(object):
    def __init__(self):
        self.tipo = None
        self.nome = None
        self.data = None


class ServicoAdmin(admin.ModelAdmin):
    list_display = ['id', 'descricao', 'porcentagem']
    search_fields = ['id', 'descricao']


class PavimentoAdmin(admin.ModelAdmin):
    list_display = ['id', 'descricao']
    search_fields = ['id', 'descricao']


class AprovacaoAdmin(admin.ModelAdmin):
    list_display = ['tipo']


admin.site.register(Servico, ServicoAdmin)
admin.site.register(Pavimento, PavimentoAdmin)
admin.site.register(Aprovacao, AprovacaoAdmin)

为什么?

0 个答案:

没有答案