This commit is contained in:
@@ -4,6 +4,7 @@ from django.db.models import Sum
|
||||
from django import forms
|
||||
from unfold.admin import ModelAdmin, TabularInline
|
||||
from unfold.decorators import display
|
||||
from adminsortable2.admin import SortableAdminMixin
|
||||
from .models import ESP32Config, Order, Salesperson, WeChatPayConfig, Service, VCCourse, ProductFeature, CommissionLog, WeChatUser, Distributor, Withdrawal, ServiceOrder, CourseEnrollment
|
||||
import qrcode
|
||||
from io import BytesIO
|
||||
@@ -83,9 +84,9 @@ class WeChatPayConfigAdmin(ModelAdmin):
|
||||
)
|
||||
|
||||
@admin.register(ESP32Config)
|
||||
class ESP32ConfigAdmin(ModelAdmin):
|
||||
class ESP32ConfigAdmin(SortableAdminMixin, ModelAdmin):
|
||||
form = ESP32ConfigAdminForm
|
||||
list_display = ('name', 'chip_type', 'price', 'stock', 'has_camera', 'has_microphone')
|
||||
list_display = ('name', 'chip_type', 'price', 'stock', 'has_camera', 'has_microphone', 'order')
|
||||
list_filter = ('chip_type', 'has_camera')
|
||||
search_fields = ('name', 'description')
|
||||
inlines = [ProductFeatureInline]
|
||||
@@ -107,8 +108,8 @@ class ESP32ConfigAdmin(ModelAdmin):
|
||||
)
|
||||
|
||||
@admin.register(Service)
|
||||
class ServiceAdmin(ModelAdmin):
|
||||
list_display = ('title', 'created_at')
|
||||
class ServiceAdmin(SortableAdminMixin, ModelAdmin):
|
||||
list_display = ('title', 'created_at', 'order')
|
||||
search_fields = ('title', 'description')
|
||||
fieldsets = (
|
||||
('基本信息', {
|
||||
@@ -150,8 +151,8 @@ class ServiceOrderAdmin(ModelAdmin):
|
||||
)
|
||||
|
||||
@admin.register(VCCourse)
|
||||
class VCCourseAdmin(ModelAdmin):
|
||||
list_display = ('title', 'course_type', 'price', 'tag', 'instructor', 'lesson_count', 'duration', 'created_at')
|
||||
class VCCourseAdmin(SortableAdminMixin, ModelAdmin):
|
||||
list_display = ('title', 'course_type', 'price', 'tag', 'instructor', 'lesson_count', 'duration', 'created_at', 'order')
|
||||
search_fields = ('title', 'description', 'instructor', 'tag')
|
||||
list_filter = ('course_type', 'instructor', 'tag')
|
||||
fieldsets = (
|
||||
|
||||
Reference in New Issue
Block a user