summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2012-11-22 22:14:34 +0000
committerluxagraf <sng@luxagraf.net>2012-11-22 22:14:34 +0000
commit5ec4e9957220eda531ada80ae2969b3c4cd0bcce (patch)
treec90a5cbf30fde20ceaee287d157301d5c303a556
parent83e49fa3c3ea9b9b3f74b7302df8825aaf4e3d18 (diff)
tweaked Pages template loader to allow for custom templates based on the %s.html %(slug) model.
-rw-r--r--app/builder/base.py2
-rw-r--r--app/pages/views.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/builder/base.py b/app/builder/base.py
index a112aa0..9dc07e9 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -240,7 +240,7 @@ class BuildPages(Build):
pages = model.objects.all()
for page in pages:
c = Context({'object':page,'SITE_URL':settings.SITE_URL, 'MEDIA_URL':settings.BAKED_MEDIA_URL,'IMAGES_URL':settings.BAKED_IMAGES_URL})
- t = render_to_string('details/page.html',c).encode('utf-8')
+ t = render_to_string(["details/%s.html" % page.slug, 'details/page.html'],c).encode('utf-8')
s = render_to_string('details/page.txt',c).encode('utf-8')
fpath = '%s/' %(page.slug)
self.write_file(fpath,t)
diff --git a/app/pages/views.py b/app/pages/views.py
index 016c2ed..a568f3b 100644
--- a/app/pages/views.py
+++ b/app/pages/views.py
@@ -8,6 +8,6 @@ from pages.models import Page
def page(request,slug):
obj = get_object_or_404(Page, slug__exact=slug)
context = { 'object': obj,}
- return render_to_response('details/page.html', context, context_instance = RequestContext(request))
+ return render_to_response(["details/%s.html" % obj.slug, 'details/page.html'], context, context_instance = RequestContext(request))