Can I use my DjangoCMS template in my AppHook application?

Context: I am trying to integrate an application in my djangocms website. As i want it seems totally integrated, i want my appHooked application to use the same template as my main DjangoCMS template (I am using an extends of djangocms-frontend/bootstrap5) Everything seemed OK, until my first POST.

Problem: When i just go to an URL of my AppHook everything is fine. But if, inside a view, i try to redirect to another page of this same AppHook, the response is put inside an iframe, so i get my header, footer and menu doubled. You can see it on the screenshot (if not : my full page, including menu and footer, is shown as my"cms_content", so the menu and footer where already in display).As it does not happen if i click on a link, this problems seems to be only on POST response. Am i wronf trying to use the same template ? Can we make an actual app, with post and response, to looks like it is a content on the CMS page ? To be clear : I would hope to continue to see the menu and footer when i am on my AppHooked application.

Here is a bit of my code :

---- main_app(djangocms)/template/base.html ---

{% extends "bootstrap5/base.html" %} 
[...]

{% block content %}
    {% placeholder "Page Content" %}
    {% block cms_content %} {% endblock %}       
    {% block footer %}{% include "footer.html" %}{% endblock %} 
{% endblock %}

---- my_apphooked/template/larp/form.html ---

{% extends CMS_TEMPLATE %}
{% load django_bootstrap5 %}

{% block cms_content %}

    <form action="{{ url_validation }}" method="post">
        {% csrf_token %}
        {% bootstrap_form form %}
        {% bootstrap_button button_type="submit" content="Valider" %}
    </form>

{% endblock %}

I also tried to create a "redirect template", thinking that may be, if the redirection comes from the front the problem would disapear, but this is when I discovered that my response is put inside an iframe : the redirection operate in the iframe, still showing the "inception" effect

Вернуться на верх