I have a Django project with 5 apps. Basically, in the homepage there are 3 links. I’m still not in deployment so the base url is localhost:8000 (the homepage app is called homepage). After the user clicks in one of the 3 links I want the url to stay with that number, even after using different apps.
Example of what I’m looking for: User clicks on link 1 and then → localhost:8000/1. User clicks on link that directs to another app (called ros) → localhost:8000/1/ros. And keep that one at the start of the url and only change if another of the 3 links in homepage is selected.
Example of what I’m getting so far: User clicks on link 1 and then → localhost:8000/ros/1 or localhost:8000/ros/2 or localhost:8000/ros/3 depending on the link clicked.
The question is, how can I modify the homepage URL’s and the app ROS url’s so that the ROS url receive the link parameter (either a 1,2 or 3) + ROS.urls.
HTML homepage code
<li><a href="/" class="nav-link scrollto"><i class="bx bx-home"></i> <span>Inicio</span></a></li>
<li><a href="1/ros/1" class="nav-link scrollto"><i class="bx bx-file-blank"></i> <span>ROS 1</span></a></li>
<li><a href="2/ros/2" class="nav-link scrollto"><i class="bx bx-file-blank"></i> <span>ROS 2</span></a></li>
<li><a href="3/ros/3" class="nav-link scrollto"><i class="bx bx-file-blank"></i> <span>ROS 3</span></a></li>
Homepage URL patterns
urlpatterns = [
path('',views.homepage,name='homepage'),
]
ROS URL patterns
urlpatterns = [
path('<int:ros_id>/',views.index_ros,name='index_ros')
,]
Thanks, any guidance would be helpful.