There are two applications, each has a url scheme. Is it possible to set the same name for some URLs in these applications, and if so, how then can they be addressed in templates?

There is a template that is used by the views from the first application and from the second application. And here in this template you want to put the named url, i.e. write just

{% url my_named_url %} 

but if I specify the namespaces when connecting url schemes, then it will not work. Maybe somehow you can get the name of the current application inside the template to do something like this

 {% url current_app:my_named_url %} 


    1 answer 1

    From the corresponding view, pass to the url pattern as a variable. Let the logic lie on the views, as it should be, and not on the templates.

    Or - your template tag, which does reverse and returns the result.