Make sure goal exists before checking perms

This commit is contained in:
Mouse Reeve 2021-04-11 09:58:03 -07:00
parent edf3fad54d
commit b552634a87

View file

@ -80,7 +80,7 @@ class User(View):
goal = models.AnnualGoal.objects.filter( goal = models.AnnualGoal.objects.filter(
user=user, year=timezone.now().year user=user, year=timezone.now().year
).first() ).first()
if not goal.visible_to_user(request.user): if goal and not goal.visible_to_user(request.user):
goal = None goal = None
data = { data = {
"user": user, "user": user,