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