handle the times when we have no resolver_match

This commit is contained in:
Thomas Steen Rasmussen 2017-02-19 23:12:15 +01:00
parent 9de824d877
commit 81e2be93c7

View file

@ -9,7 +9,7 @@ def camp(request):
Return it after adding the slug to request.session along with a "camps" Return it after adding the slug to request.session along with a "camps"
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 request.resolver_match and 'camp_slug' in request.resolver_match.kwargs:
try: 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