Django 6 + DRF resource server against the Gooyal accounts OAuth2 service, matching the Winsoo ecosystem's conventions. Covers locations, stores, catalog, cart, checkout/orders (with the multi-store-cart split and the status stepper), reviews, and notifications, plus a demo-data seed command. Payment integration (wallet debits, online gateway, seller payouts) is intentionally left out here — see feature/payment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import Cart, CartItem, Notification, Order, OrderGroup, OrderItem, OrderStatusLog
|
|
|
|
|
|
class OrderItemInline(admin.TabularInline):
|
|
model = OrderItem
|
|
extra = 0
|
|
|
|
|
|
class OrderStatusLogInline(admin.TabularInline):
|
|
model = OrderStatusLog
|
|
extra = 0
|
|
|
|
|
|
@admin.register(OrderGroup)
|
|
class OrderGroupAdmin(admin.ModelAdmin):
|
|
list_display = ('uuid', 'user', 'payment_method', 'payment_status', 'total_amount', 'created_at')
|
|
list_filter = ('payment_method', 'payment_status', 'delivery_type')
|
|
search_fields = ('user__username', 'recipient_name', 'recipient_phone')
|
|
|
|
|
|
@admin.register(Order)
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
list_display = ('uuid', 'store', 'customer', 'status', 'items_subtotal', 'seller_payout_amount', 'created_at')
|
|
list_filter = ('status', 'store')
|
|
search_fields = ('uuid', 'store__name', 'customer__username')
|
|
inlines = [OrderItemInline, OrderStatusLogInline]
|
|
|
|
|
|
class CartItemInline(admin.TabularInline):
|
|
model = CartItem
|
|
extra = 0
|
|
|
|
|
|
@admin.register(Cart)
|
|
class CartAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'created_at')
|
|
search_fields = ('user__username',)
|
|
inlines = [CartItemInline]
|
|
|
|
|
|
@admin.register(Notification)
|
|
class NotificationAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'recipient', 'type', 'is_read', 'created_at')
|
|
list_filter = ('type', 'is_read')
|
|
search_fields = ('title', 'body', 'recipient__username')
|