Answer the question
In order to leave comments, you need to log in
Why does the "a" tag ignore the attachment when rendering the page?
Hello!
I will explain in more detail. There is a page, it has a button, by pressing which an AJAX GET request is sent to the server, the result of render_to_string(template, context) is returned back.
The template has a link:
{% for item in persons_list %}
<tr>
<th scope="row">{{ forloop.counter }}</th>
<td>{{ item.full_name }}</td>
<td>{{ item.date1 }}</td>
<td>{{ item.date2 }}</td>
<td>{{ item.city.name }}</td>
<td>
<a href={{ item.get_absolute_url }}>
<svg class="bi bi-info-fill" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533l1.002-4.705zM10 7.5a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path>
</svg>
</a>
</td>
</tr>
{% endfor %}
<td>
<a href="/database/person/5"></a>
<svg class="bi bi-info-fill" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm.93-9.412l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533l1.002-4.705zM10 7.5a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path>
</svg>
</td>
Answer the question
In order to leave comments, you need to log in
Maybe you missed quotes?
<a href="{{ item.get_absolute_url }}">
вместо
<a href={{ item.get_absolute_url }}>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question