You could use an async request to fill the div element.
The async request is answered by Django using the template engine.
In this case, you would have to outsource the template code of the div element into a separate template file.
UPDATED WITH EXAMPLE:
Javascript:
For refreshing the view asynchronously, use JQuery for example:
$.ajax({
url: '{% url myview %}',
success: function(data) {
$('#the-div-that-should-be-refreshed').html(data);
}
});
Async View:
def myview(request):
object = ...
return render_to_response('my_template.html', { 'object': object })
Template:
{% for other_object in object.some_m2m_field.all %}
<a href="www.example.com">{{ other_object.title }}</a>
{% endfor %}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…