Answer the question
In order to leave comments, you need to log in
How to generate a link depending on the current page?
Task: let's say there is a site with a list of certain objects. The initial login to site.com takes me to site.com/object-1/ . It doesn't matter how it will happen, for example, depending on my location. So, a sidebar with all objects objects-1, objects-2, objects-3, objects-4, etc. is on all pages. Also on the site there is a main menu with the items "Address", "Contacts", "Promotions" and they are different for all objects.
The question is how to make links on the page in such a way that being, suppose, on the "Contacts" page at site.com/object-1/contacts/ , clicking on the object-3 sidebar would take me to the site.com/object-3 page /contacts/. In general, you need to somehow remember which object the user is currently on and generate links depending on it.
The server part on Django and there it will be implemented, as I understand it, using regular expressions in urls.py, but how can such links be generated in the html itself?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question