1. 如下图所示
image.png2.修改model.py
之前为
class Message(models.Model):
# 车辆车牌号
car_num = models.CharField(max_length=10, verbose_name='车牌')
# 车辆颜色
car_col = models.CharField(max_length=5, verbose_name='车辆颜色')
# 车辆品牌
car_pai = models.CharField(max_length=10, verbose_name='车辆品牌')
修改后
class Message(models.Model):
# 车辆车牌号
car_num = models.CharField(max_length=10, verbose_name='车牌')
# 车辆颜色
car_col = models.CharField(max_length=5, verbose_name='车辆颜色')
# 车辆品牌
car_pai = models.CharField(max_length=10, verbose_name='车辆品牌')
class Meta:
verbose_name = '信息'
verbose_name_plural = '信息'
3.再次启动查看
image.png4. 修改注册信息
之前为:
image.png修改admin.py
class HostCar(admin.ModelAdmin):
list_display = [
'id',
'car_num',
'car_col',
'car_pai',
]
search_fields = ('id', 'car_num')
admin.site.register(Message, HostCar)
再次启动查看
image.png5. 修改默认标题
image.png修改admin.py
admin.AdminSite.site_header = '运维系统管理后台'
admin.AdminSite.site_title = '运维系统'
网友评论