Add shopping cart and product review features
Introduces Cart and CartItem models, admin, serializers, and API endpoints for shopping cart management for both authenticated and anonymous users. Adds Review model, serializers, and endpoints for product reviews, including public creation and retrieval. Updates ProductImage ordering, enhances order save logic with notification, and improves product and order endpoints with new actions and filters. Includes related migrations for commerce, configuration, social chat, and Deutsche Post integration.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from .models import (
|
||||
Category, Product, ProductImage, Order, OrderItem,
|
||||
Carrier, Payment, DiscountCode, Refund, Invoice
|
||||
Carrier, Payment, DiscountCode, Refund, Invoice, Cart, CartItem
|
||||
)
|
||||
|
||||
|
||||
@@ -80,3 +80,26 @@ class InvoiceAdmin(admin.ModelAdmin):
|
||||
list_display = ("invoice_number", "issued_at", "due_date")
|
||||
search_fields = ("invoice_number",)
|
||||
readonly_fields = ("issued_at",)
|
||||
|
||||
|
||||
class CartItemInline(admin.TabularInline):
|
||||
model = CartItem
|
||||
extra = 0
|
||||
readonly_fields = ("product", "quantity", "added_at")
|
||||
|
||||
|
||||
@admin.register(Cart)
|
||||
class CartAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "user", "session_key", "created_at", "updated_at")
|
||||
list_filter = ("created_at", "updated_at")
|
||||
search_fields = ("user__email", "session_key")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
inlines = [CartItemInline]
|
||||
|
||||
|
||||
@admin.register(CartItem)
|
||||
class CartItemAdmin(admin.ModelAdmin):
|
||||
list_display = ("cart", "product", "quantity", "added_at")
|
||||
list_filter = ("added_at",)
|
||||
search_fields = ("cart__id", "product__name")
|
||||
readonly_fields = ("added_at",)
|
||||
|
||||
Reference in New Issue
Block a user