from django.contrib import admin from .models import CartItem from .models import Price from .models import Product from .models import ShoppingCart from .models import Subscription from .models import SubscriptionPlan class PriceInlineAdmin(admin.TabularInline): model = Price extra = 0 class ProductAdmin(admin.ModelAdmin): inlines = [PriceInlineAdmin] class SubscriptionPlanAdmin(admin.ModelAdmin): list_display = ('name', 'price', 'description', 'allowed_downloads') class ShoppingCartAdmin(admin.ModelAdmin): list_display = ('user', 'created_at', 'updated_at') class CartItemAdmin(admin.ModelAdmin): list_display = ('cart', 'resource', 'quantity', 'added_at') class SubscriptionAdmin(admin.ModelAdmin): list_display = ('user', 'is_active', 'start_date', 'end_date') admin.site.register(Product, ProductAdmin) admin.site.register(SubscriptionPlan) admin.site.register(ShoppingCart) admin.site.register(CartItem) admin.site.register(Subscription)