Hello. I want to ask you for advice. There is a multipage site , a bunch of js scripts on the site, everything works well. But on one of the pages of the site (for registered users, in your account, ad page -> add ad) the script (just a modal fancybox) is very slow. On the remaining pages, everything works quickly and flawlessly (the link that calls the script is located in the header of the site). Slowly it loads on the page where there is a form that also selects cities, regions, etc. (code below). Data is taken from the context! In Chrome, the download takes 25-28 seconds. 2.5 seconds in FireFox 
{% load hosts %} <div class="b-header"> <div class="b-header__menu"> <div class="container"> <div class="row"> <div class="col-xs-12"> <div class="b-menu"> <a>...</a> <a>...</a> <a>...</a> <a>...</a> <span class="b-menu__item btn_change-location"> <a href="#change-location" class="fancybox dashed"> {% if user.is_authenticated %} Просмотр объявлений на территории: {% if user.districts.all.count > 1 %} {% for district in user.districts.all %} {% if forloop.last %} <span>{{ district }}</span> {% else %} <span>{{ district }},</span> {% endif %} {% endfor %} {% else %} {% for district in user.districts.all %} <span>{{ district }}</span> {% endfor %} {% endif %} {% if user.regions.all.count > 1 %} {% for region in user.regions.all %} {% if forloop.last %} <span>{{ region }}</span> {% else %} <span>{{ region }},</span> {% endif %} {% endfor %} {% else %} {% for region in user.regions.all %} <span>{{ region }}</span> {% endfor %} {% endif %} {% if user.cities.all.count > 1 %} {% for city in user.cities.all %} {% if forloop.last %} <span>{{ city }}</span> {% else %} <span>{{ city }},</span> {% endif %} {% endfor %} {% else %} {% for city in user.cities.all %} <span>{{ city }}</span> {% endfor %} {% endif %} {% else %} Просмотр объявлений на территории: {% endif %} </a> </span> </div> </div> </div> </div> </div> Template modals (data retrieval from content)
{% load hosts %} {% load widget_tweaks static %} <div id="change-location"> <form action="{% host_url "setlocation" host "www" %}" method="post"> {% csrf_token %} <div id="chose-city-wrap"> <div class="b-modal__title">Выберите ваш город</div> <p> <div class="b-modal__item"> <span>{{ location_form.country.label }}</span> {{ location_form.country }} </div> </p> <p> <div class="b-modal__item"> <span>{{ location_form.districts.label }}</span> {{ location_form.districts }} </div> </p> <p> <div class="b-modal__item"> <span>{{ location_form.regions.label }}</span> {{ location_form.regions }} </div> </p> <p> <div class="b-modal__item"> <span>{{ location_form.cities.label }}</span> {{ location_form.cities }} </div> </p> <br /> <div class="b-modal__item b-modal__item_btn"> <input class="b-btn b-btn_red" type="submit" value="Сохранить"> </div> </div> </form> </div> Download cities on the page where modalka slows down!
<fieldset> <legend>Территория распространения объявления</legend> {{ form.country|add_class:"b-input__input js-select" }} {{ form.districts|add_class:"b-input__input js-select chosen-select" }} {{ form.regions|add_class:"b-input__input js-select chosen-select" }} {{ form.cities|add_class:"b-input__input js-select chosen-select" }} {# form.geo|add_class:"b-input__input" #} </fieldset>