Files
bugsink/projects/context_processors.py
Klaas van Schelven 719fcae322 Friendly 400 page that shows the error, even when DEBUG=False
when people run into ALLOWED_HOSTS troubles, they should get info on-screen ASAP
2024-11-28 12:43:14 +01:00

10 lines
369 B
Python

def user_projects_processor(request):
if not hasattr(request, "user"):
# check, because if there's a failure "very early" in the request handling, we don't have an AnonymousUser
return {"user_projects": []}
if not request.user.is_authenticated:
return {'user_projects': []}
return {'user_projects': request.user.project_set.all()}