Don't try to display subscriptions when no user is authenticated

This commit is contained in:
Adam Goldsmith 2021-05-22 11:51:05 -04:00
parent d2ff139c51
commit 47f117abe6

View File

@ -43,9 +43,13 @@ def taskDetail(request, tool_slug, task_slug):
context = { context = {
'tool': tool, 'tool': tool,
'task': task, 'task': task,
'task_subs': task.grouptasksubscription_set.filter(group__user=request.user),
'tool_subs': tool.grouptoolsubscription_set.filter(group__user=request.user),
'events': events, 'events': events,
'form': form, 'form': form,
} }
if request.user.is_authenticated:
context.update({
'task_subs': task.grouptasksubscription_set.filter(group__user=request.user),
'tool_subs': tool.grouptoolsubscription_set.filter(group__user=request.user),
})
return render(request, 'tasks/taskDetail.djhtml', context) return render(request, 'tasks/taskDetail.djhtml', context)