Template
Clients can run in-house retail without Shopify while keeping the same Docker/Django/Postgres stack and data-ownership promise. Closes #5.
25 lines
704 B
Python
25 lines
704 B
Python
from django.contrib import admin
|
|
|
|
from shop.models import Order, OrderItem, Product
|
|
|
|
|
|
@admin.register(Product)
|
|
class ProductAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "sku", "price", "stock_qty", "fulfillment", "is_published")
|
|
list_filter = ("fulfillment", "is_published")
|
|
search_fields = ("name", "sku")
|
|
prepopulated_fields = {"slug": ("name",)}
|
|
|
|
|
|
class OrderItemInline(admin.TabularInline):
|
|
model = OrderItem
|
|
extra = 0
|
|
|
|
|
|
@admin.register(Order)
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
list_display = ("number", "email", "amount", "status", "created_at")
|
|
list_filter = ("status",)
|
|
search_fields = ("number", "email", "customer_name")
|
|
inlines = [OrderItemInline]
|