Skip to content
Snippets Groups Projects
Commit b83a0501 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added 404 to information cms system

parent d260a109
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@
#
from django.shortcuts import render
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from information.models import InformationLocale, Information
from django.core.urlresolvers import reverse
......@@ -32,22 +34,26 @@ def index(request):
return render(request, 'information/index.html', context)
def detail(request, information_id):
information_locale = InformationLocale.get_information_locale_with_fallback(information_id, request.LANGUAGE_CODE)
# Is there a parent?
#parent_information = information_locale.information.parent_information
# We get all the children too
#children_locales = []
#for child in information_locale.information.children.all():
# children_locales.append(InformationLocale.get_information_locale_with_fallback(child.pk))
context = {
'information_locale' : information_locale,
#'parent_information' : parent_information,
#'children_locales':children_locales,
'breadcrumb': get_breadcrumb(information_locale.information, request.LANGUAGE_CODE),
'menu_html': get_menu_html(None, information_id, request.LANGUAGE_CODE)
}
return render(request, 'information/detail.html', context)
try:
information_locale = InformationLocale.get_information_locale_with_fallback(information_id, request.LANGUAGE_CODE)
# Is there a parent?
#parent_information = information_locale.information.parent_information
# We get all the children too
#children_locales = []
#for child in information_locale.information.children.all():
# children_locales.append(InformationLocale.get_information_locale_with_fallback(child.pk))
context = {
'information_locale' : information_locale,
#'parent_information' : parent_information,
#'children_locales':children_locales,
'breadcrumb': get_breadcrumb(information_locale.information, request.LANGUAGE_CODE),
'menu_html': get_menu_html(None, information_id, request.LANGUAGE_CODE)
}
return render(request, 'information/detail.html', context)
except ObjectDoesNotExist:
raise Http404("No information page found with id=%s" % information_id)
def get_breadcrumb(information, language):
active_id= information.pk
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment