Commit 66805404 by Őry Máté

dashboard: update notification view

parent 55773d3c
{% load i18n %} {% load i18n %}
{% for n in notifications %} {% for n in notifications %}
<li class="notification-message"> <li class="notification-message" id="msg-{{n.id}}">
<span class="notification-message-subject"> <span class="notification-message-subject">
{% if n.status == "new" %}<i class="icon-envelope-alt"></i> {% endif %} {% if n.status == "new" %}<i class="icon-envelope-alt"></i> {% endif %}
{{ n.subject }} {{ n.subject.get_user_text }}
</span> </span>
<span class="notification-message-date pull-right"> <span class="notification-message-date pull-right" title="{{n.created}}">
{{ n.created|timesince }} {{ n.created|timesince }}
</span> </span>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div class="notification-message-text"> <div class="notification-message-text">
{{ n.message|safe }} {{ n.message.get_user_text|safe }}
</div> </div>
</li> </li>
{% empty %} {% empty %}
......
...@@ -2626,12 +2626,9 @@ class NotificationView(LoginRequiredMixin, TemplateView): ...@@ -2626,12 +2626,9 @@ class NotificationView(LoginRequiredMixin, TemplateView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super(NotificationView, self).get_context_data( context = super(NotificationView, self).get_context_data(
*args, **kwargs) *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 n = 10 if self.request.is_ajax() else 1000
context['notifications'] = list( context['notifications'] = list(
self.request.user.notification_set.values()[:n]) self.request.user.notification_set.all()[:n])
return context return context
def get(self, *args, **kwargs): 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