Fix iframe views so they actually can be displayed

This commit is contained in:
Timothy Hobbs 2020-01-13 21:15:22 +01:00
parent 5da7069dbd
commit 4c1fda5991
2 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@ views/kb.py - Public-facing knowledgebase views. The knowledgebase is a
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404 from django.shortcuts import render, get_object_or_404
from django.views.decorators.clickjacking import xframe_options_exempt
from helpdesk import settings as helpdesk_settings from helpdesk import settings as helpdesk_settings
from helpdesk.models import KBCategory, KBItem from helpdesk.models import KBCategory, KBItem
@ -51,7 +52,7 @@ def category(request, slug, iframe=False):
'staff': staff, 'staff': staff,
}) })
@xframe_options_exempt
def category_iframe(request, slug): def category_iframe(request, slug):
return category(request, slug, iframe=True) return category(request, slug, iframe=True)

View File

@ -13,6 +13,7 @@ from django.shortcuts import render
from django.utils.http import urlquote from django.utils.http import urlquote
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.conf import settings from django.conf import settings
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
@ -100,6 +101,11 @@ class BaseCreateTicketView(abstract_views.AbstractCreateTicketMixin, FormView):
class CreateTicketIframeView(BaseCreateTicketView): class CreateTicketIframeView(BaseCreateTicketView):
template_name = 'helpdesk/public_create_ticket_iframe.html' template_name = 'helpdesk/public_create_ticket_iframe.html'
@xframe_options_exempt
def dispatch(self, *args, **kwargs):
return super().dispatch(*args, **kwargs)
class CreateTicketView(BaseCreateTicketView): class CreateTicketView(BaseCreateTicketView):
template_name = 'helpdesk/public_create_ticket.html' template_name = 'helpdesk/public_create_ticket.html'