示例#1
0
def set_notifications_attributes(user):
    setattr(user, 'notifications', user.notification_set.all().order_by('-created_at')[:20])
    setattr(user, 'unseen_notifications', Notification.get_number_of_unseen_notifications(user=user))
    return user