mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 16:03:19 +01:00
fix public homepage with kb_category but without kb disabled
This commit is contained in:
parent
c314d515c1
commit
e4d6a54659
@ -2,6 +2,7 @@
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from helpdesk.models import KBCategory
|
||||||
from helpdesk.tests.helpers import get_staff_user, reload_urlconf
|
from helpdesk.tests.helpers import get_staff_user, reload_urlconf
|
||||||
|
|
||||||
|
|
||||||
@ -36,3 +37,11 @@ class TestKBDisabled(TestCase):
|
|||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_public_homepage_with_kb_category(self):
|
||||||
|
KBCategory.objects.create(title="KB Cat 1",
|
||||||
|
slug="kbcat1",
|
||||||
|
description="Some category of KB info")
|
||||||
|
response = self.client.get(reverse('helpdesk:home'))
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertTemplateUsed(response, 'helpdesk/public_homepage.html')
|
||||||
|
@ -87,7 +87,10 @@ def homepage(request):
|
|||||||
form.fields['queue'].choices = [('', '--------')] + [
|
form.fields['queue'].choices = [('', '--------')] + [
|
||||||
(q.id, q.title) for q in Queue.objects.filter(allow_public_submission=True)]
|
(q.id, q.title) for q in Queue.objects.filter(allow_public_submission=True)]
|
||||||
|
|
||||||
knowledgebase_categories = KBCategory.objects.all()
|
knowledgebase_categories = None
|
||||||
|
|
||||||
|
if helpdesk_settings.HELPDESK_KB_ENABLED:
|
||||||
|
knowledgebase_categories = KBCategory.objects.all()
|
||||||
|
|
||||||
return render(request, 'helpdesk/public_homepage.html', {
|
return render(request, 'helpdesk/public_homepage.html', {
|
||||||
'form': form,
|
'form': form,
|
||||||
|
Loading…
Reference in New Issue
Block a user