parent
5f99870a31
commit
91b30f3799
13 changed files with 93 additions and 4 deletions
@ -0,0 +1,3 @@ |
||||
from .apps import BasicConfig |
||||
|
||||
default_app_config = 'apps.basic.BasicConfig' |
@ -1,3 +1,17 @@ |
||||
from django.contrib import admin |
||||
from apps.basic.models import Address |
||||
|
||||
|
||||
# Register your models here. |
||||
|
||||
@admin.register(Address) |
||||
class AddressAdmin(admin.ModelAdmin): |
||||
admin.site.site_title = '我的特产商城后台' |
||||
admin.site.site_header = '我的特产商城后台' |
||||
admin.site.index_title = '商城平台管理' |
||||
# 设置列表显示列 |
||||
list_display = ['province', 'city', 'district', 'address', 'contact_name', 'contact_mobile'] |
||||
# 设置搜索 |
||||
search_fields = ['contact_name', 'contact_mobile'] |
||||
# 过滤 |
||||
list_filter = ['city'] |
||||
|
@ -0,0 +1,3 @@ |
||||
from .apps import GoodsConfig |
||||
|
||||
default_app_config = 'apps.goods.GoodsConfig' |
@ -1,3 +1,35 @@ |
||||
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'] |
||||
|
@ -0,0 +1,3 @@ |
||||
from .apps import OrderConfig |
||||
|
||||
default_app_config = 'apps.order.OrderConfig' |
@ -1,3 +1,22 @@ |
||||
from django.contrib import admin |
||||
from apps.order.models import * |
||||
|
||||
|
||||
# Register your models here. |
||||
|
||||
@admin.register(Order) |
||||
class OrderAdmin(admin.ModelAdmin): |
||||
# 设置列表中的显示项 |
||||
list_display = ['order_id', 'order_total', 'order_price', 'memo'] |
||||
|
||||
|
||||
@admin.register(OrderGoods) |
||||
class OrderGoodsAdmin(admin.ModelAdmin): |
||||
# 设置列表中的显示项 |
||||
list_display = ['goods_id', 'goods_num', 'price'] |
||||
|
||||
|
||||
@admin.register(Cart) |
||||
class CartAdmin(admin.ModelAdmin): |
||||
# 设置列表中的显示项 |
||||
list_display = ['goods_id', 'user_id', 'goods_num'] |
||||
|
@ -0,0 +1,3 @@ |
||||
from .apps import UserConfig |
||||
|
||||
default_app_config = 'apps.user.UserConfig' |
@ -1,3 +1,11 @@ |
||||
from django.contrib import admin |
||||
from apps.user.models import MyUser |
||||
from django.contrib.auth.admin import UserAdmin |
||||
|
||||
# 如果有继承关系此处要引用两个模型, 并且使用site.register |
||||
# Register your models here. |
||||
admin.site.register(MyUser, UserAdmin) |
||||
|
||||
|
||||
class MyUserAdmin(admin.ModelAdmin): |
||||
list_display = ['username', 'email', 'is_active', 'truename', 'mobile'] |
||||
|
Loading…
Reference in new issue