2026-03-12 11:27:23 +08:00
|
|
|
from django.contrib import admin
|
2026-03-23 17:18:59 +08:00
|
|
|
from .models import Dish, DishCategory, Order
|
2026-03-12 11:27:23 +08:00
|
|
|
|
2026-03-23 17:18:59 +08:00
|
|
|
|
|
|
|
|
@admin.register(DishCategory)
|
|
|
|
|
class DishCategoryAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ['id', 'name', 'icon', 'order']
|
|
|
|
|
list_editable = ['name', 'icon', 'order']
|
|
|
|
|
search_fields = ['name']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Dish)
|
|
|
|
|
class DishAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ['id', 'name', 'category', 'view_count', 'created_at']
|
|
|
|
|
list_filter = ['category', 'created_at']
|
|
|
|
|
search_fields = ['name', 'description']
|
|
|
|
|
raw_id_fields = ['category']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Order)
|
|
|
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
|
|
|
list_display = ['id', 'name', 'status', 'party_date', 'created_at', 'completed_at']
|
|
|
|
|
list_filter = ['status', 'created_at']
|
|
|
|
|
search_fields = ['name', 'note']
|
|
|
|
|
readonly_fields = ['created_at', 'completed_at']
|
|
|
|
|
filter_horizontal = ['dishes']
|