在終端中輸入:python manage.py createsuperuser
給子應用項目設置名字
@admin.register(Wife)
class WifeAdmin(admin.ModelAdmin):
pass
@admin.register(Children)
class ChildrenAdmin(admin.ModelAdmin):
pass
@admin.register(Brother)
class BrotherAdmin(admin.ModelAdmin):
pass
#1、基本注冊
class HusbandAdmin(admin.ModelAdmin):
# 注意添加的字段一定為模型類中擁有的
list_display = ['name', 'age', 'height', 'wight', 'birthday']
# 設置每頁顯示的數據條目
list_per_page = 3
# 調整選項框的位置
# 選項框在頂部是否顯示
actions_on_top = False
# 底部是否顯示
actions_on_bottom = True
# 搜索框
search_fields = ['name', 'age', 'height']
# 過濾欄
list_filter = ['age', 'height']
admin.site.register(Husband, HusbandAdmin)