青山相待

            白云相爱

            梦不到紫罗袍共黄金带

            一茅斋

            野花开

            管甚谁家兴废谁成败

            陋巷单瓢亦乐哉

            贫,气不改!

            达,志不改!

django控制admin的model显示列表

class goods(models.Model):
    name = models.CharField(max_length=300)
    price = models.IntegerField()
    descirbe = models.CharField(max_length=300)
    email = models.EmailField()

class goodsAdmin(admin.ModelAdmin):
    list_display = ('name', 'price', 'descirbe', 'email')

admin.site.register(goods, goodsAdmin)

admin.site.register将类注册给admin管理;

注册类的时候注册一个关联的ModelAdmin可以指定显示方式。

posted @ 2015-03-26 09:19  Leo.Z  阅读(796)  评论(0编辑  收藏  举报