I use a for loop in django. When I refresh the browser, the result of the first for loop is not cleared, and the result of the second for loop is stitched together with the first one.
test.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<table border="1">
<thead>
<tr>
<th id="1">full_name</th>
<th id="2">html_url</th>
<th id="3">description</th>
<th id="4">stargazers_count</th>
</tr>
</thead>
<tbody>
{% for item in resp_list %}
<tr>
<td>{{ item.full_name }}</td>
<td>{{ item.html_url }}</td>
<td>{{ item.description }}</td>
<td>{{ item.stargazers_count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>
Among them, the resp_list here is a list obtained by saving the content I crawled from the Internet using python's requests library.
When I ran the program for the first time, there was no problem. When I refreshed my browser, the first loop was not cleared, which caused the second loop to be followed by the first loop.
I'm desperate for your help, thanks to everyone here!