feat: MVP-скелет площадки (Django + MySQL/SQLite, модели по ТЗ §4, базовые страницы)
This commit is contained in:
1 parent
e5f312a00f
commit
8218a568ce
67 files changed
+1929
No files matched your search
@@ -0,0 +1,52 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Brand, Category, Product, ProductImage, Service, TimeSlot
|
||||
|
||||
|
||||
class ProductImageInline(admin.TabularInline):
|
||||
model = ProductImage
|
||||
extra = 1
|
||||
|
||||
|
||||
@admin.register(Category)
|
||||
class CategoryAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'type', 'parent', 'sort_order')
|
||||
list_filter = ('type',)
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
search_fields = ('name',)
|
||||
|
||||
|
||||
@admin.register(Brand)
|
||||
class BrandAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'user', 'legal_status', 'verification_status', 'rating')
|
||||
list_filter = ('verification_status', 'legal_status')
|
||||
search_fields = ('name', 'inn', 'city')
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
|
||||
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'brand', 'category', 'price', 'stock', 'moderation_status', 'is_active')
|
||||
list_filter = ('moderation_status', 'is_active', 'category')
|
||||
search_fields = ('name', 'brand__name')
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
inlines = [ProductImageInline]
|
||||
|
||||
|
||||
@admin.register(ProductImage)
|
||||
class ProductImageAdmin(admin.ModelAdmin):
|
||||
list_display = ('product', 'sort_order')
|
||||
|
||||
|
||||
@admin.register(Service)
|
||||
class ServiceAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'brand', 'format', 'duration_minutes', 'price', 'moderation_status')
|
||||
list_filter = ('format', 'moderation_status')
|
||||
search_fields = ('name', 'brand__name')
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
|
||||
|
||||
@admin.register(TimeSlot)
|
||||
class TimeSlotAdmin(admin.ModelAdmin):
|
||||
list_display = ('service', 'start', 'end', 'is_booked')
|
||||
list_filter = ('is_booked',)
|
||||
Reference in new issue
Block a user