All checks were successful
Build and Push Docker Image / build (push) Successful in 42s
- Added `Cart` and `CartItem` models with migrations for managing user-specific carts and items - Developed services for cart-related operations: adding, removing, and updating cart items - Built specialized templates (`cart.html`) and styled them with new CSS assets (`cart.css`) - Enabled real-time UI updates via AJAX in shopping cart interactions (`cart.js`) - Modified header to dynamically display cart link with user authentication awareness - Added Leaflet-based interactive map to the contacts page and integrated CSS/JS dependencies - Expanded tests for cart functionality, item detail page cart integration, and contacts page maps
23 lines
621 B
Python
23 lines
621 B
Python
from django.contrib import admin
|
|
|
|
from orders.models import Cart, CartItem
|
|
|
|
|
|
class CartItemInline(admin.TabularInline):
|
|
model = CartItem
|
|
extra = 0
|
|
|
|
|
|
@admin.register(Cart)
|
|
class CartAdmin(admin.ModelAdmin):
|
|
list_display = ("user", "updated_at", "created_at")
|
|
search_fields = ("user__username", "user__email")
|
|
inlines = [CartItemInline]
|
|
|
|
|
|
@admin.register(CartItem)
|
|
class CartItemAdmin(admin.ModelAdmin):
|
|
list_display = ("item", "cart", "quantity", "updated_at")
|
|
list_select_related = ("cart", "item", "cart__user")
|
|
search_fields = ("item__name", "cart__user__username", "cart__user__email")
|