http - Adding headers to django CBV -
I want to add a x-frames-option
header to the Django CreateView. I need this because I will serve a form that will be loaded in iframe tags.
The problem is that there are many ways in the dynamic class-based ideas that HPTPPSpacse objects return. All What is the method to add headers without reactions written to those methods?
class MyView (CreateView): def find (auto, request, * args, ** kwargs): resp = super (MyView, self) .get (requests, * args, ** kwargs ) Resp ['x-frames-option'] = '' return resp # will go equally form_invalid, post, put, etc ...
OK, I've decided to do it if you have to face the same problem, so how to do it in the above example code Similarly, the render_to_response method must be overwritten.
Comments
Post a Comment