5👍
✅
Got it!
urls.py
url(r'^(?P<url>.*)$', 'Alpha.blog.views.flatpage', {}, 'flatpage'),
views.py:
def flatpage(request, url):
try:
if url == '':
url = 'home/'
flatpage = FlatPage.objects.get(url="/%s" % url)
except:
pass
if request.is_ajax():
template = 'pages/ajax.html'
else:
template = 'pages/default.html'
context_instance=RequestContext(request)
context_instance.autoescape=False
return render_to_response(template, {'flatpage': flatpage}, context_instance)
👤FLX
Source:stackexchange.com