HI, I am new to Django, I want to display table data to Modal html form but it always shows the 1st record on Modal form. For e.g. in the image below, I have clicked on 43. TEST - 4, 43 is the primary key, I want to display the primary key in the Modal title, But
the Modal title shows the primary key 41 which is 1st record.
here is the html code
<div class="col-md-7 col-lg-6.5" style="height: 600px; overflow: scroll;">
<!-- List of all the tasks for the day -->
{% for i in dictTask %}
<div class="card m-1">
<div class="card-body">
{{i.pk}} - {{i.firstname}} - {{i.lastname}} - {{i.phonenumber}}
<span style="position: relative; float: right;">
<a href="{% url 'markasdonename' i.pk %}" class="btn btn-success" data-toggle="modal" data-target="#exampleModal"><i class="fa fa-check"></i> Mark as Done</a>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">PRIMARY KEY {{i.pk}} </h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
<input type="text" name="firstname" class="form-control" placeholder="First Name" value="{{ i.firstname}}"><br>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</span>
</div>
</div>
{% endfor %}
</div>