There was a problem of big branching in templates. It looks like this:
{% if shop} {% if active_first_category %} <div class="left-block border-block left"> <div class="left-block-content"> {% for category in active_first_category.producttypessecondlayer_set.all %} <p><a href= "{% url 'site:supermarket_second_products_list' city.slug supermarket.slug active_first_category.slug category.slug %}"> {{ category }} </a></p> {% endfor %} </div> </div> {% else %} <div class="left-block border-block left"> <div class="left-block-content"> {% for category in categories %} <p><a href= "{% url 'site:supermarket_first_products_list' city.slug supermarket.slug category.slug %}"> {{ category }} </a></p> {% endfor %} </div> </div> {% endif %} {% else %} {% if active_second_category %} <a href= "{% url 'site:second_products_list' city.slug active_first_category.slug active_second_category.slug %}"> {{ active_second_category }}</a> </div> {% elif active_first_category %} <div class="left-block border-block left"> <div class="left-block-content"> {% for category in active_first_category.producttypessecondlayer_set.all %} <p><a href= "{% url 'site:second_products_list' city.slug active_first_category.slug category.slug %}"> {{ category }} </a></p> {% endfor %} </div> </div> {% else %} <div class="left-block border-block left"> <div class="left-block-content"> {% for category in categories %} <p> <a href= "{% url 'site:first_products_list' city.slug category.slug %}"> {{ category }} </a></p> {% endfor %} </div> </div> {% endif %} {% endif %} All this is a disgrace left panel with navigation. Practically for all cases, the site view is the same: on the left is the navigation pane, in the center is a list of products.
Accordingly, all these cases are processed with one view and one template, but the url of all these cases is different and then there is a problem. I have to make huge branches replacing only {% url %} tag How to adapt I can not understand, I also don’t know what kind of query to look for such a problem. Feels like this is not the right solution to the problem.
If my 9 urls have similar mechanics, it is simply impossible to do 9 branches in one pattern. And smash into different, so after all they have the same logic.
Slightly clarify. There is a "products" page and there is a navigation by type, it leads to products / type1 , then there already appear filters on type2 and they lead to products / type1 / type2
And there is another page shops , where everything is the same, only URLs respectively shops / type1 , shops / type1 / type2
will also search search / type1 , search / type1 / type2
etc.