handle unknown camp url slugs with debugmode off

This commit is contained in:
Thomas Steen Rasmussen 2017-02-19 22:56:11 +01:00
parent 5452da1ddb
commit 69e222247b

View file

@ -10,8 +10,12 @@ def camp(request):
queryset containing all camps (used to build the menu and such) queryset containing all camps (used to build the menu and such)
""" """
if 'camp_slug' in request.resolver_match.kwargs: if 'camp_slug' in request.resolver_match.kwargs:
try:
camp = Camp.objects.get(slug=request.resolver_match.kwargs['camp_slug']) camp = Camp.objects.get(slug=request.resolver_match.kwargs['camp_slug'])
request.session['campslug'] = camp.slug request.session['campslug'] = camp.slug
except Camp.DoesNotExist:
request.session['campslug'] = None
camp = None
else: else:
request.session['campslug'] = None request.session['campslug'] = None
camp = None camp = None