diff --git a/api/views.py b/api/views.py index 62f0d49..d89eb27 100755 --- a/api/views.py +++ b/api/views.py @@ -278,7 +278,7 @@ class NotificationViewSet(viewsets.ModelViewSet): if not user.is_authenticated(): raise PermissionDenied("Not allowed") - return Notification.objects.filter(to_user=user.userprofile).order_by('-date') + return Notification.objects.filter(to_user=user.userprofile).order_by('-id') def perform_update(self, serializer): return super(NotificationViewSet, self).perform_update(serializer) diff --git a/spa/models/notification.py b/spa/models/notification.py index b15289f..e782a30 100755 --- a/spa/models/notification.py +++ b/spa/models/notification.py @@ -39,7 +39,7 @@ class Notification(BaseModel): 'user:message', self.to_user.get_session_id(), { - 'from_user': self.from_user.slug, + 'from_user': self.from_user.slug if self.from_user is not None else settings.DEFAULT_USER_NAME, 'message': self.target_desc })