admin.py文件里注册
class UserConfig(admin.ModelAdmin): # admin显示额外字段
list_display = ['pk','password']
admin.site.register(models.User,UserConfig)
class Categories(models.Model): # 文章分类
name = models.CharField(max_length=32,verbose_name='文章分类')
blog = models.ForeignKey(to='Blog',null=True)
class Meta:
verbose_name_plural = '文章分类'
db_table = ‘tb_categories’
def __str__(self):
return self.name