Refactor frontend components and backend migrations
- Removed TradingGraph component from frontend/src/components/trading. - Updated home page to import Services component and TradingGraph from new path. - Modified PortfolioPage to return null instead of PortfolioGrid. - Added initial migrations for account, advertisement, commerce, configuration, downloader, gopay, stripe, trading212, and zasilkovna apps in the backend. - Created Services component with subcomponents for Kinematografie, Drone Service, and Website Service. - Implemented TradingGraph component with dynamic data generation and canvas rendering. - Updated DonationShop component to display donation tiers with icons and descriptions.
This commit is contained in:
@@ -1,14 +1,82 @@
|
||||
from django.contrib import admin
|
||||
from .models import Carrier, Product
|
||||
# Register your models here.
|
||||
from .models import (
|
||||
Category, Product, ProductImage, Order, OrderItem,
|
||||
Carrier, Payment, DiscountCode, Refund, Invoice
|
||||
)
|
||||
|
||||
|
||||
@admin.register(Carrier)
|
||||
class CarrierAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "base_price", "is_active")
|
||||
@admin.register(Category)
|
||||
class CategoryAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "url", "parent")
|
||||
search_fields = ("name", "description")
|
||||
prepopulated_fields = {"url": ("name",)}
|
||||
|
||||
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "price", "currency", "stock", "is_active")
|
||||
search_fields = ("name", "description")
|
||||
list_display = ("name", "price", "stock", "is_active", "category", "created_at")
|
||||
search_fields = ("name", "description", "code")
|
||||
list_filter = ("is_active", "category", "created_at")
|
||||
prepopulated_fields = {"url": ("name",)}
|
||||
|
||||
|
||||
@admin.register(ProductImage)
|
||||
class ProductImageAdmin(admin.ModelAdmin):
|
||||
list_display = ("product", "is_main", "alt_text")
|
||||
list_filter = ("is_main",)
|
||||
search_fields = ("product__name", "alt_text")
|
||||
|
||||
|
||||
class OrderItemInline(admin.TabularInline):
|
||||
model = OrderItem
|
||||
extra = 0
|
||||
readonly_fields = ("product", "quantity")
|
||||
|
||||
|
||||
@admin.register(Order)
|
||||
class OrderAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "user", "email", "status", "total_price", "currency", "created_at")
|
||||
list_filter = ("status", "created_at", "country")
|
||||
search_fields = ("email", "first_name", "last_name", "phone")
|
||||
readonly_fields = ("created_at", "updated_at", "total_price")
|
||||
inlines = [OrderItemInline]
|
||||
|
||||
|
||||
@admin.register(OrderItem)
|
||||
class OrderItemAdmin(admin.ModelAdmin):
|
||||
list_display = ("order", "product", "quantity")
|
||||
search_fields = ("order__id", "product__name")
|
||||
|
||||
|
||||
@admin.register(Carrier)
|
||||
class CarrierAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "shipping_method", "state", "shipping_price", "weight")
|
||||
list_filter = ("shipping_method", "state", "returning")
|
||||
search_fields = ("id",)
|
||||
|
||||
|
||||
@admin.register(Payment)
|
||||
class PaymentAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "payment_method", "created_at")
|
||||
list_filter = ("payment_method", "created_at")
|
||||
|
||||
|
||||
@admin.register(DiscountCode)
|
||||
class DiscountCodeAdmin(admin.ModelAdmin):
|
||||
list_display = ("code", "percent", "amount", "active", "valid_from", "valid_to", "used_count", "usage_limit")
|
||||
list_filter = ("active", "valid_from", "valid_to")
|
||||
search_fields = ("code", "description")
|
||||
|
||||
|
||||
@admin.register(Refund)
|
||||
class RefundAdmin(admin.ModelAdmin):
|
||||
list_display = ("order", "reason_choice", "verified", "created_at")
|
||||
list_filter = ("verified", "reason_choice", "created_at")
|
||||
search_fields = ("order__id", "order__email", "reason_text")
|
||||
|
||||
|
||||
@admin.register(Invoice)
|
||||
class InvoiceAdmin(admin.ModelAdmin):
|
||||
list_display = ("invoice_number", "issued_at", "due_date")
|
||||
search_fields = ("invoice_number",)
|
||||
readonly_fields = ("issued_at",)
|
||||
|
||||
Reference in New Issue
Block a user