From fb21d9bcdc01f6d7e11df7053578a3072bd76575 Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Fri, 22 Jul 2022 01:20:10 +0200 Subject: [PATCH] Check for model enabled before registering --- helpdesk/admin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helpdesk/admin.py b/helpdesk/admin.py index 6fbd352d..8beb35f1 100644 --- a/helpdesk/admin.py +++ b/helpdesk/admin.py @@ -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)