def get_notifications(request): """ Shows all current notifications """ result = [] for k in notifications.keys(): i = notifications[k] if i.get('user') and i.get('user') != request.META.get('remote_user'): continue # Skipt this message if it is meant for someone else elif i.get('notification_type') == 'show_once': del notifications[k] pass result.append(i) return result