- Put this button function inside the your django function loop and update the target.
- it can be {{ forloop.counter }} or {{ instance.id }}
- whatever unique id you use, it must be the same on both button and modal.
- In modal, update id.
- You can put both button and modal inside of one loop function or separate two loop functions.
It will solve your issue.