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)
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可以指定显示方式。