You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
990 B
35 lines
990 B
from django.contrib import admin |
|
from apps.goods.models import * |
|
|
|
|
|
# Register your models here. |
|
|
|
|
|
@admin.register(GoodsCategory) |
|
class GoodsCategory(admin.ModelAdmin): |
|
admin.site.site_title = '我的特产商城后台' |
|
admin.site.site_header = '我的特产商城后台' |
|
admin.site.index_title = '商城平台管理' |
|
# 设置列表中显示的字段 |
|
list_display = ['name', 'logo', 'sort', 'create_time'] |
|
# 设置搜索条件 |
|
search_fields = ['name'] |
|
# 设置过滤 |
|
list_filter = ['name', 'parent_id'] |
|
# 设置日期选择器 |
|
data_hierarchy = 'create_time' |
|
# 设置分页 |
|
list_per_page = 10 |
|
# 设置排序 |
|
ordering = ['sort'] |
|
|
|
|
|
@admin.register(Goods) |
|
class GoodsAdmin(admin.ModelAdmin): |
|
# 设置列表中显示哪些字段 |
|
list_display = ['name', 'market_price', 'price'] |
|
|
|
@admin.register(Slide) |
|
class SlideAdmin(admin.ModelAdmin): |
|
# 设置列表中显示哪些字段 |
|
list_display = ['goods_id', 'sort', 'images']
|
|
|