35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import Category, ContactInquiry, Product
|
|
|
|
|
|
@admin.register(Category)
|
|
class CategoryAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "sort_order")
|
|
prepopulated_fields = {"slug": ("name",)}
|
|
search_fields = ("name",)
|
|
ordering = ("sort_order", "name")
|
|
|
|
|
|
@admin.register(Product)
|
|
class ProductAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "category", "price_from", "is_featured", "is_active")
|
|
list_filter = ("category", "is_featured", "is_active")
|
|
list_editable = ("is_featured", "is_active")
|
|
prepopulated_fields = {"slug": ("name",)}
|
|
search_fields = ("name", "short_description", "description", "material")
|
|
|
|
|
|
@admin.register(ContactInquiry)
|
|
class ContactInquiryAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "subject", "preferred_contact_method", "status", "created_at")
|
|
list_filter = ("preferred_contact_method", "status", "created_at")
|
|
list_editable = ("status",)
|
|
search_fields = ("name", "email", "phone", "subject", "message")
|
|
autocomplete_fields = ("product",)
|
|
|
|
|
|
admin.site.site_header = "Thelen Atelier Admin"
|
|
admin.site.site_title = "Thelen Atelier"
|
|
admin.site.index_title = "Katalog & Anfragen verwalten"
|