30 lines
921 B
Python
30 lines
921 B
Python
from wagtail.contrib.modeladmin.options import ModelAdmin, ModelAdminGroup, modeladmin_register
|
|
from .models import BasicKnowledge, InstrumentCategory, InstrumentType
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
class InstrumentAdmin(ModelAdmin):
|
|
model = BasicKnowledge
|
|
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',)
|
|
|
|
|
|
class InstrumentGroup(ModelAdminGroup):
|
|
menu_label = _('Instruments')
|
|
items = (InstrumentAdmin, InstrumentTypeAdmin, InstrumentCategoryAdmin,)
|
|
|
|
|
|
modeladmin_register(InstrumentGroup)
|