skillbox/server/basicknowledge/wagtail_hooks.py

27 lines
812 B
Python

from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from .models import BasicKnowledge, InstrumentCategory, InstrumentType
class InstrumentAdmin(ModelAdmin):
model = BasicKnowledge
menu_label = 'Instruments'
list_display = ('title', 'new_type', 'status_string')
search_fields = ('title', 'new_type__name')
class InstrumentCategoryAdmin(ModelAdmin):
model = InstrumentCategory
list_display = ('name', 'background', 'foreground')
class InstrumentTypeAdmin(ModelAdmin):
model = InstrumentType
list_display = ('name', 'category',)
inspect_view_enabled = True
inspect_view_fields = ('name', 'category', 'instruments',)
modeladmin_register(InstrumentAdmin)
modeladmin_register(InstrumentCategoryAdmin)
modeladmin_register(InstrumentTypeAdmin)