comfy/artel/store/admin.py

72 wiersze
1.6 KiB
Python
Czysty Zwykły widok Historia

2023-04-27 21:06:28 +00:00
from django.forms import fields
2023-04-24 20:11:27 +00:00
2023-04-27 21:06:28 +00:00
from wagtail.contrib.modeladmin.options import (
ModelAdmin,
ModelAdminGroup,
modeladmin_register
)
from wagtail.admin.forms.models import WagtailAdminModelForm
from store import models
2023-05-10 19:47:03 +00:00
class ProductAuthorAdmin(ModelAdmin):
model = models.ProductAuthor
list_display = ("name", )
2023-04-27 21:06:28 +00:00
2023-05-10 19:47:03 +00:00
class ProductCategoryAdmin(ModelAdmin):
model = models.ProductCategory
list_display = ("name", )
2023-04-27 21:06:28 +00:00
2023-08-15 11:36:11 +00:00
class ProductTemplateParamAdmin(ModelAdmin):
model = models.ProductTemplateParam
2023-05-10 19:47:03 +00:00
list_display = ("key", "param_type")
2023-04-27 21:06:28 +00:00
2023-05-10 19:47:03 +00:00
class ProductTemplateAdmin(ModelAdmin):
2023-06-22 21:56:13 +00:00
menu_label = "Product design"
2023-05-10 19:47:03 +00:00
model = models.ProductTemplate
list_display = ("title", "code")
2023-04-27 21:06:28 +00:00
class ProductAdmin(ModelAdmin):
2023-06-22 21:56:13 +00:00
menu_label = "Product variant"
2023-04-27 21:06:28 +00:00
model = models.Product
2023-05-10 19:47:03 +00:00
list_display = ("title", "price")
2023-04-27 21:06:28 +00:00
class PaymentMethodAdmin(ModelAdmin):
model = models.PaymentMethod
list_display = ("name", "active")
2023-07-22 18:39:12 +00:00
class DeliveryMethodAdmin(ModelAdmin):
model = models.DeliveryMethod
list_display = ("name", "active")
class DocumentTemplateAdmin(ModelAdmin):
model = models.DocumentTemplate
list_display = ("name", )
2023-04-27 21:06:28 +00:00
class StoreAdminGroup(ModelAdminGroup):
menu_label = "Store"
menu_icon = 'folder-open-inverse'
menu_order = 200
2023-05-10 19:47:03 +00:00
items = (
ProductAuthorAdmin,
ProductCategoryAdmin,
2023-08-15 11:36:11 +00:00
ProductTemplateParamAdmin,
2023-05-10 19:47:03 +00:00
ProductTemplateAdmin,
ProductAdmin,
DocumentTemplateAdmin,
2023-07-22 18:39:12 +00:00
PaymentMethodAdmin,
DeliveryMethodAdmin
2023-05-10 19:47:03 +00:00
)
2023-04-27 21:06:28 +00:00
modeladmin_register(StoreAdminGroup)