Notifications
This page will document the notifications flow, where we are able to send the user emails with relevant information and also show it on a notifications tab from the navbar.
Notification-Related Components
pythonCopyEdit@view_config(route_name='get_notifications', renderer='json', request_method='POST')
def get_notifications(request):
user = request.session.get('user_id')
notifications = request.dbsession.query(Notification).filter_by(user_id=user).order_by(Notification.time_sent.desc()).all()
return {
'notifications': [
{
'message': n.message,
'created_at': n.time_sent.strftime("%Y-%m-%d %H:%M")
}
for n in notifications
]
}Summary
Last updated