from django db import connection from django http import HttpResponse

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from django.db import connection
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.core.exceptions import ObjectDoesNotExist
from django.template import Context, loader
from django.http import HttpResponse
from corporate.pages.models import SomePage
from corporate.pages.models import TypeofthePage
# Create your views here.
def page(request, object_list):
root_page = None
for page in object_list.split('/'):
currentpage = SomePage.objects.filter(page_name__exact=page)
if root_page:
currentpage = currentpage.get(parent__exact=root_page)
else:
currentpage = currentpage.get(parent__isnull=True)
root_page = currentpage
template_file = currentpage.page_type.template_name
return render_to_response(template_file, {})