How to save a unique search result in django

I want the user to save individual search result when they click on the star button as shown below in the SS: figure 1 This results are not from the database but rather they are collected from an API.When the user clicks on the "star" button beside each search result,I want this data to be saved in the database.When the star button is pressed,I want this entire piece of data to be passed on to an approrirate function to save it in the database.I need help in forming the url when the button is pressed.Given below is the html part for the "star" button:

   <a href="#">
        <svg
        xmlns="http://www.w3.org/2000/svg"
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
                                                                        
        class="feather feather-star"
     >
  <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
      </svg>
    </a>
</div>             `    `                                            
I was thinking of generating unique id for each search result and then pass this along with the url.But dont know how to create the url pattern.
Back to Top