Here i am making a e-shop website. I made small cards to show all products in a template, using for loop. and up to here its all fine. My one card contains some information about a product. ie. name of product, price etc. Here we cant put all detail in small cards so i made a button " view product " which will take a user to another page where a user can see all the detail of a product. Say i have 1000+ products, but it is impossible to make 1000+ product detail page.
I come to a solution that is dynamic urls. ok then i wrote a url like:
path('product_detail/<int:pk>', views.product_detail, name="product_detail"),
this will take user to a specific products with their unique pk. Now the problem i am getting here is I have button in each cards of a products. So i want to write a logic, like : when a user click on the button of a card that button should redirect them to the page related to that product, from whic they clicked.
for example say a user click a button “view detail” of product “x” then the button should redirect them to a page containing the detail of product “x” Now for all buttons of all products they should redirect to that specific products…