forked from extern/django-helpdesk
Merge pull request #743 from CedricCarrard/fix/public_homepage_kbdisabled
Fix error 500 public homepage when objects kb_category
This commit is contained in:
commit
eaba30dd65
@ -2,6 +2,7 @@
|
||||
from django.urls import reverse
|
||||
from django.test import TestCase
|
||||
|
||||
from helpdesk.models import KBCategory
|
||||
from helpdesk.tests.helpers import get_staff_user, reload_urlconf
|
||||
|
||||
|
||||
@ -36,3 +37,11 @@ class TestKBDisabled(TestCase):
|
||||
raise
|
||||
else:
|
||||
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 = [('', '--------')] + [
|
||||
(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', {
|
||||
'form': form,
|
||||
|
Loading…
Reference in New Issue
Block a user