From d5b85ecc9288679c11097d3e2cfb4854cf721cee Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 19 Oct 2012 19:36:22 +0530 Subject: [PATCH] test templates --- itf/insidepages/views.py | 20 +++++++++++++++++++- itf/static/js/upload/itfUpload.js | 2 +- itf/urls.py | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/itf/insidepages/views.py b/itf/insidepages/views.py index 3f12d65..b9c3e5e 100755 --- a/itf/insidepages/views.py +++ b/itf/insidepages/views.py @@ -4,7 +4,8 @@ from django.template import RequestContext from ox.django.shortcuts import render_to_json_response import re from django.http import HttpResponse, HttpResponseRedirect - +from settings import PROJECT_ROOT +from os.path import join, exists def add_object(request, module_slug, tab_slug): tab = get_object_or_404(ModuleTab, slug=tab_slug) @@ -162,6 +163,23 @@ def render_object(request, module_slug): }) return render_to_response("noel/render_object.html", context) + +def test_template(request, template_name): + test_path = join(PROJECT_ROOT, "templates", "test_static_templates") + template_path = join(test_path, template_name + ".html") + if exists(template_path): + html = open(template_path).read() + else: + html = "Template not found." + context = RequestContext(request, { + 'item': {}, + 'item_data': {'html': html}, + 'tab': {}, + 'object_list': [], + 'tabs': [] + }) + return render_to_response("noel/render_object.html", context) + ###### #HERE BE OLD DISCARED CODE: ##### diff --git a/itf/static/js/upload/itfUpload.js b/itf/static/js/upload/itfUpload.js index 806d1c7..51e4770 100644 --- a/itf/static/js/upload/itfUpload.js +++ b/itf/static/js/upload/itfUpload.js @@ -29,7 +29,7 @@ ItfFileUpload.prototype.upload = function() { if (data.resultUrl) { that.markDone(data); } else { - that.$progressStatus.html(response.status); + that.$elem.find("progressStatus").html(response.status); } }, 'progress': that.doProgress diff --git a/itf/urls.py b/itf/urls.py index 627a942..20936d3 100755 --- a/itf/urls.py +++ b/itf/urls.py @@ -42,6 +42,8 @@ urlpatterns = patterns('', # to INSTALLED_APPS to enable admin documentation: #Test views: (r'test_profile', 'itfprofiles.views.person_form'), + (r'^test_template/(?P[a-zA-Z].*?)$', 'insidepages.views.test_template'), + (r'edit_profile', 'itfprofiles.views.edit_profile'), (r'^autocomplete/(?P\d+)', 'app.views.autocomplete'), (r'^popup_form/(?P\d+)', 'app.views.popup_form'),