Check for model enabled before registering

This commit is contained in:
Martin Whitehouse 2022-07-22 01:20:10 +02:00
parent 280462c2fe
commit fb21d9bcdc
No known key found for this signature in database
GPG Key ID: 3FCE1D3E9DEC09C1

View File

@ -1,7 +1,7 @@
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply, KBCategory
from helpdesk.models import EscalationExclusion, EmailTemplate, KBItem
from helpdesk.models import Queue, Ticket, FollowUp, PreSetReply
from helpdesk.models import EscalationExclusion, EmailTemplate
from helpdesk.models import TicketChange, KBIAttachment, FollowUpAttachment, IgnoreEmail
from helpdesk.models import CustomField
from helpdesk import settings as helpdesk_settings
@ -82,9 +82,10 @@ if helpdesk_settings.HELPDESK_KB_ENABLED:
list_display_links = ('title',)
@admin.register(KBCategory)
class KBCategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'title', 'slug', 'public')
if helpdesk_settings.HELPDESK_KB_ENABLED:
@admin.register(KBCategory)
class KBCategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'title', 'slug', 'public')
@admin.register(CustomField)