我正在使用 django 通知,但是当未读通知增加时,加载时间和复制时间也在增加。如何优化此代码?
{% for notification in request.user.notifications.unread %}
<li><div class="media">
<div class="media-left">
<div class="media-object">
<img data-src="holder.js/50x50?bg=cccccc" class="img-circle" alt="50x50" style="width: 50px; height: 50px;"
src="{{ BASE_DIR}}/media/profile_pictures/{{notification|getNotifUser}}/profile.jpg" data-holder-rendered="true">
</div>
</div>
<div class="media-body">
<strong class="notification-title">
<a id="{{ notification.target_object_id }}" class="{{ notification.pk }}">
{{ notification.actor_object_id|get_username}} {{notification.verb}} - request {{notification.target_object_id}}</a></strong>
<div class="notification-meta">
<small class="timestamp">{{ notification.timesince | getLocalTimeDifference}} əvvəl</small>
</div>
</div>
</div> </li>
{% endfor %}