handle the times when we have no resolver_match
This commit is contained in:
parent
9de824d877
commit
81e2be93c7
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue