python - How to send data from multiple blocks to backend in Django? -


my current template structure contains 2 blocks, "page_content" , "sidebar". there html-form "post" method in "page_content" block sends data backend, problem form working mobile-size screen only, , desktop there second block - "sidebar". hole thing has point in terms of template structure, has 0 point in terms of logic, because anytime want send data via "sidebar" block - won't sent backend. problem, unfortunately can't change template structure, mean i'm not allowed rid of 2-blocks structure, must keep them have make "sidebar" block send data backend "page_content" does. how can accomplish ?

here code:

{% block page_content %}     <form id="main_form" class="form-horizontal" action="." method="post">{% csrf_token %}         {{ order_form_set.management_form }}          <div class="mobile-order-wrapper">             <div class="mobile-order-container">                 <p class="mobile-cart-header text-center">cart</p>                 <div class="mobile-cart-items">                     {% in order_form_set %}                         {% include 'orders/includes/order_mobile_form.html' data=i.initial %}                     {% endfor %}                 </div>             </div>         </div>         <button>order!</button>      </form> {% endblock page_content %}   {% block sidebar %}     <div class="cart-container" data-spy="affix" data-offset-top="195">         <div class="cart-title">cart</div>         <div class="cart-items-container">             {% j in order_form_set %}                 {% include 'orders/includes/order_desktop_form.html' data=j.initial %}             {% endfor %}         </div>     </div> {% endblock sidebar %} 

i believe have 2 options:

first, should use ajax send request backend.

second, should put second block inside first 1 , hide of css or javascript when device mobile.

as saying can't change second block, think should go first option.

hope helps!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -