1👍
✅
you should default return (fallback dict) when the boolean expression is not satisfied, something like:
if request.user.is_authenticated():
...
return {
'notification_events': events,
'notification_mails': mails
}
else:
#fallback
return {
'notification_events': None,
'notification_mails': None
}
Source:stackexchange.com