Commit 66805404 by Őry Máté

dashboard: update notification view

parent 55773d3c
{% load i18n %}
{% for n in notifications %}
<li class="notification-message">
<li class="notification-message" id="msg-{{n.id}}">
<span class="notification-message-subject">
{% if n.status == "new" %}<i class="icon-envelope-alt"></i> {% endif %}
{{ n.subject }}
{{ n.subject.get_user_text }}
</span>
<span class="notification-message-date pull-right">
<span class="notification-message-date pull-right" title="{{n.created}}">
{{ n.created|timesince }}
</span>
<div style="clear: both;"></div>
<div class="notification-message-text">
{{ n.message|safe }}
{{ n.message.get_user_text|safe }}
</div>
</li>
{% empty %}
......
......@@ -2626,12 +2626,9 @@ class NotificationView(LoginRequiredMixin, TemplateView):
def get_context_data(self, *args, **kwargs):
context = super(NotificationView, self).get_context_data(
*args, **kwargs)
# we need to convert it to list, otherwise it's gonna be
# similar to a QuerySet and update everything to
# read status after get
n = 10 if self.request.is_ajax() else 1000
context['notifications'] = list(
self.request.user.notification_set.values()[:n])
self.request.user.notification_set.all()[:n])
return context
def get(self, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment